android - Trying to make a Navigation Drawer that doesn't overlap another view -
i'm trying make app has sidebar (a linear layout, now; sort of actionbar) on left buttons that, when clicked, open navigation drawer, which, when opened, should right of sidebar. problem drawer overlaps else. how prevent it? also, how make drawer start right side of sidebar instead of left side of screen? otherwise part of contents hidden sidebar.
is impossible drawer? forced use slidingpanellayout? searched on internet found nothing.
here's activity's xml:
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawerlayout" android:layout_width="match_parent" android:layout_height="match_parent" > <linearlayout android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <linearlayout android:id="@+id/sidebar" android:layout_width="wrap_content" android:layout_height="match_parent" android:background="@color/list_background" android:minwidth="30dp" android:orientation="vertical" > <button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/ic_menu1" android:minwidth="30dip" android:minheight="30dip" /> </linearlayout> <!-- main view of activity --> <listview android:id="@+id/normallist" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" > </listview> </linearlayout> <!-- drawer's list --> <listview android:id="@+id/list_slidermenu" android:layout_width="200dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="@color/list_background" android:choicemode="singlechoice" android:divider="@color/list_divider" android:dividerheight="1dp" android:listselector="@drawable/list_selector" /> </android.support.v4.widget.drawerlayout>
the single items of both lists:
<!-- drawer --> <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="48dp" android:background="@drawable/list_selector"> <imageview android:id="@+id/drwrimg" android:layout_width="25dp" android:layout_height="25dp" android:layout_alignparentleft="true" android:layout_marginleft="12dp" android:layout_marginright="12dp" android:contentdescription="@string/icondescription" android:src="@drawable/item" android:layout_centervertical="true" /> <textview android:id="@+id/drwrtext" android:layout_width="wrap_content" android:layout_height="30dp" android:layout_torightof="@id/drwrimg" android:textcolor="@color/white" android:gravity="center_vertical" android:paddingright="40dp"/> <textview android:id="@+id/drwrcounter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/counter_bg" android:layout_alignparentright="true" android:layout_centervertical="true" android:layout_marginright="8dp" android:textcolor="@color/counter_text_color" /> </relativelayout> <!-- , main list --> <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fileslistdrawerlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="2dp" > <imageview android:id="@+id/img" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_margin="2dp" android:contentdescription="@string/icondescription" /> <textview android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="30dp" android:layout_aligntop="@+id/img" android:layout_torightof="@+id/img" android:gravity="center_vertical" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/numberoffiles" android:layout_width="wrap_content" android:layout_height="20dp" android:layout_alignbottom="@+id/img" android:layout_below="@+id/text" android:layout_torightof="@+id/img" android:gravity="center_vertical" android:textappearance="?android:attr/textappearancesmall" /> </relativelayout>
an image of sidebar how now:
and how want be:
edit #2: made question more clear.
edit #3: clarified more , added images, show desired result.
Comments
Post a Comment