У меня есть кусок кодаAndroid Именование Layout Схема
public class Radio_groupActivity extends ListActivity {
TextView selection;
String[] items={"One", "Two", "Three"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1));
}
}
Теперь у меня есть main.xml в папке, но у меня нет каких-либо файл XML с именем simple_list_item_1
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/selection"
/>
<ListView android:layout_height="fill_parent"
android:id="@+id/list"
android:layout_width="fill_parent"></ListView>
</LinearLayout>
Итак, какова связь списка с @ id/list и тем android.R.layout.simple_list_item_1?
но setListAdapter упоминает только simple_list_item_1 это не говоря уже о @id/Список вообще. – lilzz
Это не обязательно. '@android: id/list' определяется каркасом, он уже известен ListActivity. – adamp