android - SrollView in content of DrawerLayout prevents the drawer to be opened by swiping -


when put scrollview content of drawerlayout, nolonger able open drawer swiping side.

activity layout:

<android.support.v4.widget.drawerlayout     xmlns: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"> <!-- menu_main content view --> <framelayout         android:id="@android:id/content"         android:layout_width="match_parent"         android:layout_height="match_parent"/> <!-- navigation drawer --> <listview         android:name="com.gumtree.androidapp.drawerfragment"         android:id="@+id/drawer"         android:layout_width="240dp"         android:layout_height="match_parent"         android:layout_gravity="start" /> </android.support.v4.widget.drawerlayout> 

in activity's oncreate add fragment has following layout:

<scrollview     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent">  <linearlayout               android:orientation="vertical"               android:layout_width="match_parent"               android:layout_height="match_parent">      <imageview             android:layout_height="160dp"             android:layout_width="match_parent"/>      <textview             android:id="@+id/headline"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:textsize="@dimen/headline_text_size"             android:padding="@dimen/detail_text_padding"             android:textisselectable="false"/>      <textview             android:id="@+id/description"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:textsize="@dimen/description_text_size"             android:padding="@dimen/detail_text_padding"             android:textisselectable="false"/>   </linearlayout> </scrollview> 

without scrollview works fine , able open drawer swiping side. when add scrollview, stops working.

what solution this?

the problem here silly named id of framelayout used content container of drawerlayout. used system id (android.r.id.content) caused content fragment put on top of other views - drawer.

it caused fragment's layout overlap drawer , - related question - blocked drawer receiving touch events. touch events taken fragment's scrollview.

conclusion: do not use system ids (android.r.*) where not needed.

i wanted nice , clean.. silly me :)


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -