我不知道发生了什么我第一次发布这个扩展活动的类。但即使将其更改为ListActivity,它仍然不起作用。我会把它贬低到我认为问题所在的地方。问题与我的setListAdapter()
public class PassScreen extends ListActivity {
String[] items = {"lorem","ipsum", "dolor"};// I have it calling an xml file but switched it to this just to see if that was the problem.
setContentView(R.layout.passwordscreen);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,
items));
我不明白你的意思。这是我的书使用的。我检查,以确保xml文件显示适当的ListView和它。但在这里它是无论如何:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/selection"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"/>
</LinearLayout>
你有什么错误? – 2011-05-27 06:46:03
不,我可以运行该应用程序。 – Funlamb 2011-05-27 06:50:12
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List1.html – 2011-05-27 06:59:56