我想創建一個listView,但我想在每個listitem有2個不同的textViews和一個按鈕..這可能嗎?是否有可能在一個listView項目中有兩個TextView?
讀音字使用行XML文件,我的列表項..
public class main extends Activity {
private ListView lv1;
private String lv_arr[]={"a","b","c","d"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
lv1=(ListView)findViewById(R.id.list);
lv1.setAdapter(new ArrayAdapter<String>(this,R.layout.row , lv_arr));
lv1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
switch(position)
{
case 0: Intent newActivity = new Intent(chania.this, cafe.class);
break;
//...........
}
}
});
}
}
其他人請嗎? – kostas 2011-05-02 10:23:12