android - ListViews Behind ActionBar -
i made 1 activity navigationview. when select 1 item of navigationview loads 1 fragment. .xml contains layouts activity , fragment:
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> //layout activity <relativelayout android:id="@+id/separator" android:layout_width="match_parent" android:layout_height="match_parent" > <listview android:id="@+id/firstlist" android:layout_width="wrap_content" android:layout_height="wrap_content" android:choicemode="multiplechoice" android:clickable="false" /> </relativelayout> //layout fragment <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <listview android:id="@+id/secondlist" android:layout_width="match_parent" android:layout_height="match_parent" /> </relativelayout> </linearlayout> <include layout="@layout/app_bar_main" android:layout_width="match_parent" android:layout_height="wrap_content" /> </relativelayout> <android.support.design.widget.navigationview android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerlayout="@layout/nav_header_main" app:menu="@menu/activity_main_drawer" /> </android.support.v4.widget.drawerlayout>
the problem lists (listviews). behind action bar , don't know why.
i think problem .xml. if necessary provide more code. thanks.
edit app_bar.xml:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" > <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/apptheme.appbaroverlay"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:popuptheme="@style/apptheme.popupoverlay" /> </android.support.design.widget.appbarlayout> </android.support.design.widget.coordinatorlayout>
this happening because of wrong xml.
<relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout
add id layout.
android:id="@+id/list_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
add make following change in app_bar_main
<include layout="@layout/app_bar_main" android:layout_above="@id/list_layout" android:layout_width="match_parent" android:layout_height="wrap_content" />
Comments
Post a Comment