I'm working on NavigationDrawer
that has a FrameLayout
as the first child, and a ListView as the second. I've successfully populated a list of items I want programmatically. Now, I want a little bit of modification. I want another list populated inside the navigation drawer but I want it to be bottom-aligned. I looked at a couple of examples but couldn't make it work.
Can you tell me how can I make it work?
Here's my main Navigation layout (activity_navigation.xml
)
<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" >
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/left_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:background="#111"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>
My individual list itmes file (listview_item_row.xml
)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/navigation_drawer_list_item_selector"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:padding="10dp" >
<ImageView
android:id="@+id/imageViewIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:paddingRight="10dp" />
<TextView
android:id="@+id/textViewName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/imageViewIcon"
android:paddingRight="10dp"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="#ffffff" />
</RelativeLayout>
In my activity class, I'm programatically setting layout this way:
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
ObjectDrawerItem[] drawerItem = new ObjectDrawerItem[3];
drawerItem[0] = new ObjectDrawerItem(R.drawable.ic_speedometer, mNavigationDrawerItemTitles[0]);
drawerItem[1] = new ObjectDrawerItem(R.drawable.ic_place, mNavigationDrawerItemTitles[1]);
drawerItem[2] = new ObjectDrawerItem(R.drawable.ic_price, mNavigationDrawerItemTitles[2]);
DrawerItemCustomAdapter adapter = new DrawerItemCustomAdapter(this, R.layout.listview_item_row, drawerItem);
mDrawerList.setAdapter(adapter);
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
How can I make another list just the way I'm creating the current one?
I want it to look like this:
(picture took from this question)
Kind of new to the Android world. Thank you in advance. Update: I was able to nest my ListView inside a LinearLayout, then created another ListView inside that LinearLayout. Now, how do I assign ListView items to the bottom ListView controller?