android 在GridView的item弹出层上的按钮使用ImageView做为按钮的状态背景图问题

需要在GridView的每个item上显示一个编辑层,编辑层上有四个按钮,起初是用ImageView来做的这四个按钮,但发现一个百思不得骑姐的问题。

使用ImageView做为按钮的效果图:

当在编辑层上点中间的空白处时,四个按钮的状态背景图竟然同时触发了,这是不希望出现的情况。

希望达到的效果是只有点击了相应的按钮才会触发相应的状态背景,点空白的地方是不希望触发任何状态背景图的。

布局如下:

 

    <RelativeLayout 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/rl_zbEditStatus"
        android:layout_marginLeft="10dip"
        android:layout_marginRight="10dip"
        android:layout_marginTop="56dip"
        android:background="@drawable/book_edit_bg"
        >
        <ImageView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/selector_zbedit_set"
            android:id="@+id/zb_edit_set"
            android:layout_marginLeft="15dip"
            android:layout_marginTop="15dip"
            />
        <ImageView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/selector_zbedit_del"
            android:id="@+id/zb_edit_del"
            android:layout_below="@id/zb_edit_set"
            android:layout_marginLeft="15dip"
            android:layout_marginTop="30dip"
            />
        <ImageView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/selector_zbedit_desktop"
            android:layout_alignParentRight="true"
            android:layout_marginRight="15dip"
            android:layout_marginTop="15dip"
            android:id="@+id/zb_edit_desktop"
            />
        <ImageView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/selector_zbedit_upgrade"
            android:layout_alignParentRight="true"
            android:layout_below="@id/zb_edit_desktop"
            android:layout_marginRight="15dip"
            android:layout_marginTop="30dip"
            android:id="@+id/zb_edit_upgrade"
            />
        
        
    </RelativeLayout>

 

在网上完全查不到这样类似的问题。

起初以为是布局的问题,把RelativeLayout改成了LinearLayout,把wrap_content改成fill_parent问题依然存在,这个布局中除了RelativeLayou就只能是ImageView了,最后把ImageView改成了Button达到了希望的效果。

然后我又在网上搜索了ImageView和Button的状态背景图问题,也没有类似这样的问题。

此问题只能暂时以Button替换ImageView来解决了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值