ExpandableListView里给child的每个item添加了ImageView。如何对imageview设置监听!

在ExpandableListView里给child的每个item添加了ImageView。如何对imageview设置监听!希望实现的效果是点击imageview弹出一个小窗口。谢谢各位大神给点指导了,小白初学最好能给点代码,不然看不懂额。

child的布局文件xml是这样的,里面有一个ImageView。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/selector_2"
    android:gravity="left"
    android:orientation="horizontal"
    android:paddingBottom="0.0dip"
    android:paddingTop="0.0dip" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:gravity="left"
        android:orientation="vertical"
        android:paddingBottom="0.0dip"
        android:paddingTop="0.0dip" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="60dip" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:text="姓名:"
                android:textColor="@color/white"
                android:textSize="15dp" />

            <TextView
                android:id="@+id/item_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:paddingLeft="10dip"
                android:textColor="@color/white"
                android:textSize="15dp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="60dip" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:text="手机:"
                android:textColor="@color/white_two"
                android:textSize="15dp" />

            <TextView
                android:id="@+id/item_familyphone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:paddingLeft="10dip"
                android:text="No data"
                android:textColor="@color/white_two"
                android:textSize="15dp" >
            </TextView>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:gravity="right"
         >

        <ImageView
            android:id="@+id/myCursor"
            android:layout_width="43.0dip"
            android:layout_height="58.0dip"
            android:clickable="true"
            android:layout_gravity="center_vertical"
            android:src="@drawable/my007" >
        </ImageView>
    </LinearLayout>

</LinearLayout>


ExpandableListView里是通过下面代码实现数据添加显示的。


ExpandableListView userlist = (ExpandableListView) findViewById(R.id.list02);

List<Map<String, Object>> Groups = new ArrayList<Map<String, Object>>();
Map<String, Object> groupone = new HashMap<String, Object>();
groupone.put("groupname", "技术部");
Groups.add(groupone);
Map<String, Object> grouptwo = new HashMap<String, Object>();
grouptwo.put("groupname", "销售部");
Groups.add(grouptwo);
Map<String, Object> groupthree = new HashMap<String, Object>();
groupthree.put("groupname", "人事部");
Groups.add(groupthree);

ArrayList data = DBHelper.getInstance(this).getUserList();

SimpleExpandableListAdapter simpleExpandableListAdapter = new SimpleExpandableListAdapter(
MainActivity.this, Groups, R.layout.group,
new String[] { "groupname" }, new int[] { R.id.group }, data,
R.layout.child, new String[] { "name", "familyphone" },
new int[] { R.id.item_name, R.id.item_familyphone });

userlist.setAdapter(simpleExpandableListAdapter);


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值