嘿伙计们,我正在尝试设置列表视图上的第一项检查,但代码不起作用。
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);
}}
我希望检查第一个单选按钮的活动图片 任何帮助将不胜感激 最好的问候 HP