android - Use an Image for DrawerLayout background -
i've search on line , here, can not find usefull answer on : "how can set image background navigationdrawer's listview ?"
the problem whenever listview's background isn't "solid" color (#aabbcc example), drawerlayout doesn't show.
here's layout :
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/drawer_layout"> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"/> <!-- navigation drawer --> <listview android:id="@+id/left_drawer" android:layout_width="wrap_content" android:layout_height="match_parent" android:background="#aabbcc" android:layout_gravity="start" android:choicemode="singlechoice" android:divider="@android:color/transparent" android:dividerheight="0dp" /> [... rest of main layout ...]
if change android:background="#aabbcc"
android:background="@drawable/menu_bg"
, app screen grey , drawer doesn't show.
solutions i(ve try doesn't work (same result) : drawerlayout background listview drawer layout has overridden background
is possible set image instead of single color in navigationdrawer ?
thanks.
what making drawer relativelayout
, adding imageview
underneath listview
:
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/drawer_layout"> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- main layout --> </framelayout> <relativelayout android:layout_width="300dp" android:layout_height="match_parent" android:layout_gravity="start"> <!-- navigation drawer --> <imageview android:id="@+id/drawer_bg" android:src="@drawable/img2" android:layout_width="match_parent" android:layout_height="match_parent"/> <listview android:id="@+id/drawer_list" android:background="@null" android:layout_width="match_parent" android:layout_height="match_parent"/> </relativelayout>
Comments
Post a Comment