我有 ListView 项目:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layerItem"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="55dip"
android:layout_height="fill_parent"
android:id="@+id/layerImage"/>
<TextView
android:id="@+id/layerTitle"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:paddingLeft="6.0dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"/>
</LinearLayout>
如何听触摸 ImageView 并获取项目编号?
私有 AdapterView.OnItemClickListener mLayersListListener = new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//here touch on ImageView or TextView?
}
};