Toolbar takes full screen in Android Navigation Drawer -
i made toolbar:
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="80dp" android:background="#ff5722" > </android.support.v7.widget.toolbar>
the problem when include in main_activity.xml
below:
<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" android:elevation="7dp"> <!--<relativelayout 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" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity"> <span style="font-size: x-small;"><relativelayout 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" tools:context=".mainactivity">--> <include android:id="@+id/tool_bar" layout="@layout/tool_bar" android:layout_height="80dp" android:layout_width="match_parent" /> <android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="320dp" android:layout_height="match_parent" android:layout_gravity="left" android:background="#ffffff" android:scrollbars="vertical"> </android.support.v7.widget.recyclerview> </android.support.v4.widget.drawerlayout>
it takes full screen of main activity.. have given height of toolbar 80dp.
how can solve this?
your main_activity layout should this:
<?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" android:elevation="7dp"> // first view containing tool bar , framelayout <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <include layout="@layout/tool_bar"></include> <framelayout android:layout_width="match_parent" android:layout_height="match_parent"> </framelayout> </linearlayout> // second view i.e. receylerview <android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="320dp" android:layout_height="wrap_content" android:layout_gravity="left" android:background="#ffffff" android:scrollbars="vertical"> </android.support.v7.widget.recyclerview> </android.support.v4.widget.drawerlayout>
Comments
Post a Comment