I have designed a custom listview. In that view i have one textview and two edittext fields. when i am clicking on the individual rows in listview that perform another activity(i.e another page will open). But i cannot perform onclick action on my listview.
我写了一些代码,但它没有用。我已经显示了如下代码。
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.sharefolioedit);
getList();
lv.setAdapter(new EfficientAdapter(this));
lv = getListView();
lv.setClickable(true);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parentView, View childView,
int position, long id) {
Intent intent = new Intent(CategoryList.this,AddSubCategoryList.class);
startActivity(intent);
}
}
答案 0 :(得分:0)
这对我来说很好:
this.setListAdapter(new EfficientAdapter(this));
this.getListView().setOnItemClickListener ( new AdapterView. OnItemClickListener ( )
{
public void onItemClick ( AdapterView <?> aView, View v, int position, long id )
{
Intent intent = new Intent(CategoryList.this,AddSubCategoryList.class);
startActivity(intent);
}
});