I am adding a box layout to my Actvity, which uses fragments. I implemented this as described here in the Android documentation. And the drawer adapter adapter and “View All” work in that they are displayed, but the drawer expands “under” the contents of the fragment. Here is a picture of what is happening:
Does anyone know why this could be? My code for xml activity and actiity add snippet below:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alarm_list);
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction();
fragmentTransaction.replace(android.R.id.content,
new AlarmListFragment());
fragmentTransaction.commit();
setUpDrawer(fragmentManager);
}
private void setUpDrawer(FragmentManager fm) {
String[] drawerItems = getResources().getStringArray(
R.array.drawer_array);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ListView drawerList = (ListView) findViewById(R.id.left_drawer);
drawerList.setAdapter(new ArrayAdapter<String>(this,
R.layout.item_nav_drawer, drawerItems));
drawerList.setOnItemClickListener(new
DrawerItemClickListener(drawer,drawerList,drawerItems,fm));
}
Markup:
<?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" >
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/alarm_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</FrameLayout>
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>
Do I need to install z-index? I can provide any additional information that I would really like to know!
source
share