嘿傢伙我想設置列表視圖上的第一項檢查,但代碼無法正常工作。listview checked
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class ListView1 extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String[] names = new String[] { "Android", "Windows7", "Symbian", "iPhone",
"Android", "Windows7", "Symbian", "iPhone",
"Android", "Windows7", "Symbian", "iPhone" };
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_single_choice,
android.R.id.text1, names));
ListView listView = getListView();
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setSelection(0);
listView.setSelected(true);
}}
picture of the activity 我想第一個單選按鈕被選中 任何幫助,將不勝感激爲 問候 HP
你是什麼意思由chec k? – confucius 2012-04-18 16:17:39