即时通讯相当新的机器人,所以我道歉,如果这是一个小白上下的问题(:
im quite new to android, so i apologise if this is a noob-ish question (:
我设计我的下面发现这里的例子列表:的http://android-er.blogspot.com/2010/06/custom-arrayadapter-with-with-different.html
i designed my list following the example found here: http://android-er.blogspot.com/2010/06/custom-arrayadapter-with-with-different.html
但我想知道的是我将如何去有关添加的setContentView(R.layout.main),这样我就可以显示与列表中其他(XML)元素?
but what i would like to know is how would i go about adding setContentView(R.layout.main) so that i can display other (xml) elements along with the list?
感谢您的建议(:
您只需编辑您的main.xml看任何你希望它看起来,例如:
You just edit your main.xml to look whatever you want it to look, eg:
<?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">
<View android:id="@+id/emptyview"
android:layout_height="30dp"
android:layout_width="fill_parent"
/>
<ListView android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="true"
android:stackFromBottom="true"
android:layout_below="@id/emptyview"
android:headerDividersEnabled="true"
/>
</RelativeLayout>
改变你的活动范围只能活动,不ListActivity。最后,在你的活动,你就可以获取你的列表视图:
Change your activity to extend only Activity, not ListActivity. Finally, in your activity you can then fetch your list view with:
ListView list = (ListView) findViewById(R.id.listview);
和做任何你需要做的清单。
and do whatever you need to do with the list.