How to decrease the height of the drawer layout android? - 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.

Related

Navigation bar with scroll view android

This is my layout which is using the nav bar and scroll view.
<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=".AccountActivity">
<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">
<!-- your content layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:elevation="0dp" />
</android.support.design.widget.AppBarLayout>
<!--content of account activity-->
<ScrollView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<RelativeLayout 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/activity_setup"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AccountActivity">
<ImageView
android:layout_width="match_parent"
android:background="#drawable/listgrad"
android:id="#+id/imageView"
android:layout_height="100dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:text="Name"
android:layout_below="#+id/profilepic"
android:id="#+id/accountnamefield"
android:textSize="18sp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recently Match"
android:id="#+id/recentMatchTitle"
android:textSize="18sp"
android:layout_below="#+id/accountnamefield"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/recentMatchProductList"
android:layout_below="#+id/recentMatchTitle"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
</android.support.v7.widget.RecyclerView>
<ImageButton
android:layout_width="150dp"
android:layout_height="150dp"
app:srcCompat="#mipmap/ic_account_circle_white_36dp"
android:id="#+id/profilepic"
android:background="#drawable/round_button"
android:layout_marginTop="21dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/drawer" />
</android.support.v4.widget.DrawerLayout>
I am using scroll view with the nav drawer. Why do I open and close the nav drawer then the view will scroll to bottom position? Can I move it to top or remain the same position? Please give me some helps.
Remove android:inputType="textPersonName" part first for TextView.Then
add android:scrollbars="vertical" to your ScrollView .It worked fine for me.
Here I will post the code I used for testing, ScrollView kept same position while using NavigationDrawer
<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=".MainActivity">
<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">
<!-- your content layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:elevation="0dp" />
</android.support.design.widget.AppBarLayout>
<!--content of account activity-->
<ScrollView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:scrollbars="vertical"
>
<LinearLayout 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/activity_setup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/bla"
android:id="#+id/accountnamefield"
android:textSize="18sp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recently Match"
android:id="#+id/recentMatchTitle"
android:textSize="18sp"
android:layout_below="#+id/accountnamefield"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_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>
Your layout has bunch of problems:
android:layout_alignParentStart="true" - the same thing as left (or right for RTL)
android:layout_alignParentEnd="true" - the same thing as right (or
left for RTL)
It's wrong to declare start and left in the same time
Using a recycler view inside ScrollView - bad practice and will never work. You can use nested scroll view (RecyclerView inside ScrollView is not working), but the better solution is put what you want inside scroll view (as headers and footers).
I think there is no way to measure your layout. Try to figure out how android is drawing views (https://medium.com/#britt.barak/measure-layout-draw-483c6a4d2fab#.y7nd8gyql).
P.S. You have much more problems with your layout, it's easier to write a new one, than pointing all problems.

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

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>

Align Menu items vertically in center

I have a menu with fragment (the screen of each menu's item). I need to align this items in center vertically.
There's my code:
activity_maps.xml (the screen of 'map' item)
<?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="match_parent">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/map"
tools:context=".HomeFragment"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
and the menu_item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:background="#drawable/list_selector">
<ImageView
android:id="#+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="200dp"
android:contentDescription="#string/desc_list_item_icon"
android:src="#drawable/ic_home"
android:gravity="center_vertical"
android:layout_centerVertical="true" />
</RelativeLayout>
There's the activity_main with the menu which has some menu_itens.xml inside a listView
<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_centerVertical="true"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="#+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Listview to display slider menu -->
<ListView
android:id="#+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector"
android:background="#color/list_background"/>
Edit: print link
http://s12.postimg.org/3ysbeaarx/Screenshot_2015_03_06_10_35_53.png
you can use this LinearLayout instead of ListView
<LinearLayout
android:layout_width="240dp"
android:layout_height="fill_parent"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
or u can redesign as u like with any layout

Android Navigation Drawer is overwriting my main layout

I recently added a Navigation Drawer to my Android layout. The Drawer itself is working fine, however the old layout is not displaying at all (the elements are there, but not visable).
I have tried to play around with the positioning of the elements, but nothing seems to work.
This is my Layout:
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout android:id="#+id/container" android:layout_width="match_parent"
android:layout_height="match_parent" android:background="#FFFFFF">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FFFFFF"
android:id="#+id/displayframe"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/Content"/>
<Spinner
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:background="#AAAAAA"
android:id="#+id/spinner"
android:layout_margin="15dp"/>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1399cb"
android:layout_weight="1"
/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBar2"
android:background="#1399cb"
android:layout_gravity="center_horizontal" />
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#1399cb"
android:gravity="center" >
</RelativeLayout>
</LinearLayout>
</FrameLayout>
<fragment android:id="#+id/navigation_drawer"
android:layout_width="#dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="schoolbus.tracker.datavoice.schoolbusdrawer.NavigationDrawerFragment"
tools:layout="#layout/fragment_navigation_drawer"
/>
</android.support.v4.widget.DrawerLayout>
This is the navigation drawer fragment:
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content"
android:layout_height="match_parent" android:choiceMode="singleChoice"
android:divider="#android:color/black" android:dividerHeight="0dp"
android:background="#cccc" tools:context=".NavigationDrawerFragment"
/>
and the layout I use to inflate it:
<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"
android:background="#1399cb"
tools:context=".MainActivity$PlaceholderFragment">
<ImageView android:id="#+id/icons" android:layout_height="40dp" android:layout_width="40dp"
android:contentDescription="" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="#+id/textView4"
android:textColor="#FFFFFF"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:textSize="19dp"
android:layout_alignTop="#+id/icons"
android:layout_toRightOf="#+id/icons"
android:layout_toEndOf="#+id/icons" />
</RelativeLayout>
Thank you in advance.
Why don't go like this:
main activity layout
<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">
<!-- The main content view -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- 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="#android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
Drawer
then in your activity just add fragment to content_frame and that's it:
getFragmentManager().beginTransaction()
.replace(R.id.content_frame, fragmentToShow)
.commit();
Actually you haven't closed your FrameLayout inside this layout file,nevertheless i can't see any mistake placed except for that.
EDITED: You must put your frameLayout inside the LinearLayout
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FFFFFF"
android:id="#+id/displayframe">
<FrameLayout android:id="#+id/container" android:layout_width="match_parent"
android:layout_height="match_parent" android:background="#FFFFFF">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/Content"/>
<Spinner
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:background="#AAAAAA"
android:id="#+id/spinner"
android:layout_margin="15dp"/>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1399cb"
android:layout_weight="1"
/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBar2"
android:background="#1399cb"
android:layout_gravity="center_horizontal" />
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#1399cb"
android:gravity="center" >
</RelativeLayout>
</FrameLayout>
</LinearLayout>
Also Is there any type of rendering problem when you compile it?

how to add title to navigation drawer in android

I have created a navigation drawer having a listview with icon and text. Now, I want to add a title above it and also another below it. Below are two xml I have used:
<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">
<!-- <fragment
android:id="#+id/badMap"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" /> -->
<FrameLayout
android:id="#+id/testFrame"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="#+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<!-- Listview to display slider menu -->
<ListView
android:id="#+id/list_slidermenu"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector"
android:background="#color/list_background"/>
</android.support.v4.widget.DrawerLayout>
</FrameLayout>
</RelativeLayout>
And:
<?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="40dp"
android:background="#drawable/list_selector">
<LinearLayout
android:id="#+id/itemLayout"
android:layout_width="fill_parent"
android:layout_height="55dp"
android:layout_alignParentLeft="true"
android:orientation="vertical"
android:layout_marginTop="0dp"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="55dp"
>
<ImageView
android:id="#+id/drawerIcon"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:contentDescription="#string/desc_list_item_icon"
android:src="#drawable/high"
android:layout_centerVertical="true"
android:gravity="center" />
<TextView
android:id="#+id/drawerTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/drawerIcon"
android:gravity="center"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:layout_centerVertical="true"
android:text="#string/drawerlistTitle"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="#color/list_item_title" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#DADADC"
></View>
</LinearLayout>
</RelativeLayout>
Any ideas on how to add a titles in this?
It's simple actually :-)
Instead of using a ListView as your drawer, you can wrap the ListView in a RelativeLayout for instance like this:
<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" >
<FrameLayout
android:id="#+id/testFrame"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="#+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<!-- Listview to display slider menu -->
<RelativeLayout
android:layout_width="200dp"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Title" />
<ListView
android:id="#+id/list_slidermenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/titleTextView"
android:layout_above="#+id/titleUnderListView"
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" />
<TextView
android:id="#+id/titleUnderListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="SubTitle" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
</FrameLayout>
</RelativeLayout>
You can put whatever you like as the layout for the NavigationDrawer - the sky is the limit :-)
Another solution could be to add a header and footer to your current ListView, but then it wouldn't be fixed on top or the bottom.

Categories

Resources