У меня есть ListView
с тремя ImageButton
с и TextView
с, ImageView
. Как я могу выполнить onListItemClick
в ListView
для отдельных действий для каждого ImageButton
.
public class AndroidThumbnailList extends ListActivity{
..........
ib2=(ImageButton)findViewById(R.id.imageButton2);
ib3=(ImageButton)findViewById(R.id.imageButton3);
ib1=(ImageButton)findViewById(R.id.imageButton1);
public class MyThumbnaildapter extends ArrayAdapter<String>{
public MyThumbnaildapter(Context context, int textViewResourceId,String[] objects) {
super(context, textViewResourceId, objects);
// TODO Auto-generated constructor stub
}
public View getView(int position, View convertView, ViewGroup parent) {
.........
}
}
protected void onListItemClick(ListView l, View v, int position, long id) {
Log.e("video", "called");
super.onListItemClick(l, v, position, id);
if(v.equals(ib1)){
....
}
if(v.equals(ib2)){
....
}
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new MyThumbnaildapter(AndroidThumbnailList.this, R.layout.row, _videosId));
}
}
Если я коснусь ImageButton no action is done and the
Кнопка ImageButton также не будет выделена.
мой XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="100dp" android:descendantFocusability="blocksDescendants">
<image view>....</image view>
<LinearLayout android:orientation="vertical" android:descendantFocusability="blocksDescendants"
<ImageButton android:id="@+id/imageButton1 ... ></ImageButton>
<ImageButton android:id="@+id/imageButton2 ... ></ImageButton>
<ImageButton android:id="@+id/imageButton3 ... ></ImageButton>
пожалуйста, помогите мне.