Android Listview Onitemclicklistener Being Blocked By Progressbar
I had my onItemClickListener working for my ListView inside of my DrawerLayout working fine. But I added a ProgressBar that is displayed before anything else then it is set to View
Solution 1:
Found the solution, instead of adding a new element inside of the Root DrawerLayout, put it inside of the FrameLayout where your main content should go. This was a dumb mistake by me, but if anyone else is having the same problem. Here it is:
<android.support.v4.widget.DrawerLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/drawer_layout"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity" ><FrameLayoutandroid:id="@+id/main"android:layout_width="match_parent"android:layout_height="match_parent" ><ProgressBarandroid:id="@+id/device_progress"style="?android:attr/progressBarStyleLarge"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:indeterminateDrawable="@drawable/progress"android:visibility="gone" /></FrameLayout><ListViewandroid:id="@+id/drawer"android:layout_width="240dp"android:layout_height="match_parent"android:layout_gravity="left"android:background="#000"android:choiceMode="singleChoice" /></android.support.v4.widget.DrawerLayout>
Solution 2:
There are multiple View inside your DrawerLayout. The doc suggest you only have two!
To add a navigation drawer, declare your user interface with a DrawerLayout object as the root view of your layout. Inside the DrawerLayout, add one view that contains the main content for the screen (your primary layout when the drawer is hidden) and another view that contains the contents of the navigation drawer.
I would suggest to group the ListvView and the ProgressBar in one container
Post a Comment for "Android Listview Onitemclicklistener Being Blocked By Progressbar"