I have a SlidingDrawer
as a sibling of GridView
, when the sliding drawer is opened and if its scrolled (inside sliding drawer) the grid view which is behind is also scrolled.
I implemented like :
@Override
public void onDrawerOpened() {
gridView.setEnabled(false);
}
@Override
public void onDrawerClosed() {
gridView.setEnabled(true);
}
and also implemented with OnTouchListener()
as mentioned in this thread, but its still get scrolled.
NOTE : Above impl. works in the case where each item in the gridview is non-click-able, but if each item in gridview is click-able, its get scrolled
UPDATE :
Actually, setEnabled()
and OnTouchListener()
is not working because while scrolling the focus goes to the inner elements (where click listener is set) of the gridview and it make the gridview scrolled. Is there any work around for this?
Found a work around,
sliding_drawer.xml
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Slider" />
<LinearLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true" > <---- Make the content click able so the focus goes to this and makes the list, grid view at back to stop scrolling.
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TetxtView 1" />
</LinearLayout>