How do I get my navigation drawer height to fill screen? - android

How do I get my navigation drawer height to fill screen? As it is, it only wraps content. I want my navigation drawer to extend to the bottom but have the items in it to remain floating to the top.
Here is my activity layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
android:background="?attr/colorPrimary"/>
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:id="#+id/container"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:id="#+id/pane"/>
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="#+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#999"
android:dividerHeight="1dp"
android:background="#android:color/transparent"/>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
Here is my drawer layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:paddingLeft="10dp"
android:paddingStart="10dp"
android:background="#color/drawer_background">
<ImageView
android:id="#+id/drawer_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:paddingBottom="2dp"
android:layout_gravity="bottom"
android:background="#android:color/transparent"/>
<TextView
style="#style/drawer_item"
android:id="#+id/drawer_item"
android:layout_gravity="bottom"
android:gravity="bottom"
android:maxLines="1"/>
</LinearLayout>

Related

custom header view not heighlight when drawerlayout open

I am using drawerlayout with custom view instead of toolbar,when drawer open custom view faded,but i want when drawerlayout open custom header view should not fade.
my view look now drawerlayout screen
mainactivity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="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.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="#+id/header_view"
layout="#layout/layout_header_view"
android:layout_width="fill_parent"
android:layout_height="50dp" />
<FrameLayout
android:id="#+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footer_RL"
android:layout_below="#+id/header_view">
</FrameLayout>
<RelativeLayout
android:id="#+id/footer_RL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<include
layout="#layout/layout_footer_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/drawer_List"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="50dp"
android:background="#color/white"
android:choiceMode="singleChoice"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:background="#color/white"
android:orientation="vertical"
android:visibility="gone"
android:weightSum="5">
</LinearLayout>
<ListView
android:id="#+id/drawer_List1"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/white"
android:choiceMode="singleChoice" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
You can use toolbar instead of using header view.
toolbar layout
<android.support.v7.widget.Toolbar android:background="#color/colorPrimary"
android:elevation="4dp"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
local:popupTheme="#style/ThemeOverlay.AppCompat.Light"
local:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto">
<include layout="#layout/textview"/>
</android.support.v7.widget.Toolbar>
textview layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Welcome"
android:textColor="#color/colorPrimaryDark"
android:textStyle="bold"
android:textAppearance="?android:textAppearanceLarge"/>
</LinearLayout>
your layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="#layout/layout_toolBar"/>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footer_RL"
>
</FrameLayout>
<RelativeLayout
android:id="#+id/footer_RL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<!--<include-->
<!--layout="#layout/layout_footer_view"-->
<!--android:layout_width="fill_parent"-->
<!--android:layout_height="wrap_content" />-->
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/drawer_List"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="50dp"
android:background="#color/colorPrimary"
android:choiceMode="singleChoice"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:background="#color/colorPrimary"
android:orientation="vertical"
android:visibility="gone"
android:weightSum="5">
</LinearLayout>
<ListView
android:id="#+id/drawer_List1"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/colorPrimary"
android:choiceMode="singleChoice" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>

How to place navigation drawers header below statusbar?

I want my header of my Navigation drawer to be below the statusbar. When searching for solutions, every result is about how to place it under the status bar. I have of course tried to "reverse" theese solutions to place the header below. But it hasn't worked and I'm testing it on a Samsung Galaxy S7 API 23
Right now it looks like this:
This is my layout containing DrawerLayout, NavigationView:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00ffff"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
android:id="#+id/toolbar_drawer_layout"
layout="#layout/navdrawer_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/arion_darkgray"
android:fitsSystemWindows="true"
app:headerLayout="#layout/navdrawer_header"
app:itemBackground="#drawable/nav_drawer_selector"
app:itemIconTint="#fff"
app:itemTextColor="#fff"
app:menu="#menu/navdrawer_menu"
app:theme="#style/custom_navDrawer_style" />
</android.support.v4.widget.DrawerLayout>
Toolbar layout:
<?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"
tools:context=".MyHorseActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/myhorse_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/arion_darkblue">
<RelativeLayout
android:id="#+id/myhorse_toolbar_innerlayout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#android:color/transparent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingRight="70dp"
android:text="My Horse"
android:textColor="#fff"
android:textSize="24sp" />
<ImageView
android:backgroundTint="#ff0000"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginRight="10dp"
android:background="#drawable/circle_shape" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<include
layout="#layout/divider_lightblue"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true">
</include>
</android.support.design.widget.AppBarLayout>
<include
android:id="#+id/activity"
layout="#layout/myhorse_activity_" />
Much of this is auto generated by Android Studio after I created my NavigationDrawer Class from the wizard
You have not put your xml fully so I don't know whats wrong with your xml but if you want your navigation drawer below action bar then put your drawerlayout below your toolbar as follows
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Start of the Toolbar and its items -->
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" />
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"></LinearLayout>
<!--Used for displaying Navigation Drawer slide-->
<LinearLayout
android:id="#+id/navigation_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:orientation="vertical">
<FrameLayout
android:id="#+id/navigation_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
According to your edited question drawerlayout xml would be like
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="#+id/toolbar_drawer_layout"
layout="#layout/navdrawer_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.v4.widget.DrawerLayout 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:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00ffff"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
android:id="#+id/activity"
layout="#layout/myhorse_activity_" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/arion_darkgray"
android:fitsSystemWindows="true"
app:headerLayout="#layout/navdrawer_header"
app:itemBackground="#drawable/nav_drawer_selector"
app:itemIconTint="#fff"
app:itemTextColor="#fff"
app:menu="#menu/navdrawer_menu"
app:theme="#style/custom_navDrawer_style" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
and toolbar layout will be like
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context=".MyHorseActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/myhorse_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/arion_darkblue">
<RelativeLayout
android:id="#+id/myhorse_toolbar_innerlayout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#android:color/transparent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingRight="70dp"
android:text="My Horse"
android:textColor="#fff"
android:textSize="24sp" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginRight="10dp"
android:background="#drawable/circle_shape"
android:backgroundTint="#ff0000" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<include
layout="#layout/divider_lightblue"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
I used the xml file below to achieve what you asked. But this way, the drawer opens below both the "status bar" and the "toolbar"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context=".MainActivity">
<include xmlns:android="http://schemas.android.com/apk/res/android" layout="#layout/toolbar" />
<android.support.v4.widget.DrawerLayout
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:elevation="5dp">
<FrameLayout
android:id = "#+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</FrameLayout>
<ListView
android:background="#ffffff"
android:id = "#+id/drawerList"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:elevation="5dp"></ListView>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>

android layout with fragment breaks when toolbar is there

Couldn't find a more appropriate title but my problem is the following. I have a LinearLayout that contains another LinearLayout and a fragment. I also want to add the toolbar but when I do so, then I only see the toolbar and the other screen is just white.
Here is the layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="horizontal"
tools:context="xeniasis.mymarket.MainActivity">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:weightSum="4">
<LinearLayout
android:id="#+id/categories_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="20dp">
<ExpandableListView
android:id="#+id/categories_listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<fragment
android:id="#+id/mainPane"
android:name="xeniasis.mymarket.Products"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
tools:layout="#layout/activity_main" />
</LinearLayout>
</LinearLayout>
Toolbar:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
android:padding="5dp"
android:theme="#style/ToolbarTheme" />
And the fragment layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context="xeniasis.mymarket.MainActivity">
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/swipeRefreshContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="#dimen/activity_vertical_margin">
<GridView
android:id="#+id/productsGridview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:numColumns="3"></GridView>
</android.support.v4.widget.SwipeRefreshLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_margin="8dp"
android:clickable="true"
android:elevation="5dp"
android:src="#android:drawable/ic_menu_search" />
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>
This only happens when I have a fragment, cause I previously had the same xml with a static layout where the fragment is now.
The problem is that you used a LinearLayout with
android:orientation="horizontal"
and since the toolbar has match_parent as width it occupies all the screen.
Try to use
android:orientation="vertical"
in the root layout

Unintentionally Overlapping Android Views

My xml file uses the android DrawerLayout. It shows the Toolbar and RecyclerView upon opening the app which is what I want, but when I open the drawer and click an option, the RecyclerView and fragment that was clicked are overlapping.
My code
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="#+id/profileDrawer"
android:layout_height="match_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/robot_chooser_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/content_frame2">
<android.support.v7.widget.RecyclerView
android:id="#+id/robot_recycler_view"
android:paddingTop="5dp"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView
android:id="#+id/robot_empty_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="20sp"
android:text="#string/no_robots"
android:elevation="3dp"
android:layout_gravity="center"
android:visibility="gone"
android:gravity="center" />
</FrameLayout>
</LinearLayout>
<ListView
android:id="#+id/left_drawer2"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#eee"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:listSelector="#android:color/darker_gray" />
</android.support.v4.widget.DrawerLayout>
[IMG]http://i63.tinypic.com/157fbps.png[/IMG]
I'm bringing the fragment to the front using this line in my main activity
fragmentManager.beginTransaction().replace(R.id.content_frame2, fragment).commit();
Your problem is that the activity has multiple containers:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/content_frame2">
<android.support.v7.widget.RecyclerView
android:id="#+id/robot_recycler_view"
android:paddingTop="5dp"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView
android:id="#+id/robot_empty_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="20sp"
android:text="#string/no_robots"
android:elevation="3dp"
android:layout_gravity="center"
android:visibility="gone"
android:gravity="center" />
</FrameLayout>
You are loading your fragment in the FrameLayout, but you still have the RecyclerView. You should only have a FrameLayout in the activity XML, and your fragment will load the RecyclerView, TextView or whatever you want in there. As it is now, you seem to be loading your fragment in the FrameLayout, while leaving the RecyclerView in place, which causes the overlap.
Your layout should be like this:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/profileDrawer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/robot_chooser_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<FrameLayout
android:id="#+id/content_frame2"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<ListView
android:id="#+id/left_drawer2"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#eee"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:listSelector="#android:color/darker_gray" />
</android.support.v4.widget.DrawerLayout>

How to decrease the height of the drawer layout android?

In my application I'm using navigation drawer. I want to decrease the height of the drawer. please help me.
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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/r1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/my_awesome_toolbar"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/background">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/logo"
android:layout_marginTop="7dp"
android:layout_gravity="center"/>
</android.support.v7.widget.Toolbar>
<FrameLayout
android:id="#+id/frame_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/my_awesome_toolbar"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"></FrameLayout>
</RelativeLayout>
<ListView
android:id="#+id/left_drawer"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:divider="#FFFFFF"
android:dividerHeight="4px"
android:background="#1e365a"
android:choiceMode="singleChoice" />
</android.support.v4.widget.DrawerLayout>
It totally covers the complete height of the screen. And even the drawer icon is not showing after it is clicked.

Categories

Resources