android:slidingDrawer not showing listview content?
I hvae a sliding drawer in which i tried to list a listview. My problem is listview contents not showing in side sliding drawer.But outside of this ,its working perfectly.My code shows below.
<SlidingDrawer
android:id="@+id/slidingDrawer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:handle="@+id/handle"
android:content="@+id/content"><Button
android:id="@id/handle"
android:layout_width="fill_parent"
android:text="Notification"
android:background="@drawable/notification"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_height="27dp"
android:textSize="10sp"
android:textColor="#fff"
android:textStyle="bold"
/> <LinearLayout
android:id="@+id/notificationLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"android:background="#fff"><ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"android:gravity="bottom"
android:layout_weight="1"/>
<TextView
android:id="@id/content"
开发者_如何学Go android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#8c8c8c"
android:gravity="bottom"
android:visibility="gone"
android:text=""/>
</LinearLayout> </SlidingDrawer>
AugustineBasically you need to put the listview inside a LinearLayout with @id/content.
<LinearLayout android:id="@id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Below there is a list view." />
<ListView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/listview_"
android:divider="@android:color/transparent"
android:dividerHeight="10.0sp" />
</LinearLayout>
In onCreate()
// add some data
ArrayList<MyData> myDataList = new ArrayList<MyData>();
....
myDataList.add(one);
....
mListView = (ListView) findViewById(R.id.listview_);
mListView.setAdapter(new MyListAdapter(this, R.layout.row, myDataList));
精彩评论