Eclipse 使用ArrayAdapter在listview上绘制布局

Eclipse 使用ArrayAdapter在listview上绘制布局,eclipse,listview,drawable,android-arrayadapter,Eclipse,Listview,Drawable,Android Arrayadapter,如何在布局中设置一个可绘制视图以使用listview? 这通常是我的代码和函数,但我无法单击项目: public class ListMobileActivity extends Activity { static final String[] Ristoranti = new String[] { "Osteria Mingot", "Cecchini", "Barrique", "Mediterraneo"}; ListView listView1; @Override public

如何在布局中设置一个可绘制视图以使用listview? 这通常是我的代码和函数,但我无法单击项目:

public class ListMobileActivity extends Activity {

static final String[] Ristoranti = new String[] { "Osteria Mingot", "Cecchini", "Barrique", "Mediterraneo"};

ListView listView1;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list);

    ListView listView1 = (ListView) findViewById(R.id.listView);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_mobile, R.id.label, Ristoranti);

    listView1.setAdapter(adapter);


}
公共类ListMobileActivity扩展活动{
静态最终字符串[]Ristoranti=新字符串[]{“Osteria Mingot”、“Cecchini”、“Barrique”、“Mediterano”};
列表视图列表视图1;
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.list);
ListView listView1=(ListView)findViewById(R.id.ListView);
ArrayAdapter=新的ArrayAdapter(这个,R.layout.list\u mobile,R.id.label,Ristoranti);
listView1.setAdapter(适配器);
}

如果我扩展活动,我可以设置我的可绘制,如果我扩展ListActivity,我可以单击项目,但每个项目中都会显示可绘制

protected void onItemClick(ListView l, View v, int position, long id)  {

    //get selected items
//  String selectedValue = (String) getListAdapter().getItem(position);
    //Toast.makeText(this, selectedValue, Toast.LENGTH_SHORT).show();

}

我已经用extends-ListActivity和listView.setBackgroundDrawable(getResources().getDrawable(R.drawable.drawable))解决了这个问题;