按钮像ImageView的android系统中点击效果 [英] Button like click effect for Imageview in android

查看:118
本文介绍了按钮像ImageView的android系统中点击效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ImageView的将导航到另一个页面,一旦它被点击。现在它被点击的用户将不会得到任何的时候觉得它被点击。所以,我想是有在点击图片时有一定的影响(如在正常的按钮)....谁能帮我?

I'm having an imageview which will navigate to another page once it is clicked. Right now when it is clicked user will not be getting any feel that it is clicked. So what i want is to have some effect (like in normal button) at the time of click on the image....can anyone help me?

推荐答案

尝试这样的选择

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true"><shape>
            <solid android:color="#151B8D" />

            <stroke android:width="1dp" android:color="#151B8D" />

            <corners android:bottomLeftRadius="8dp" android:bottomRightRadius="0dp" android:topLeftRadius="0dp" android:topRightRadius="8dp" />

            <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
        </shape></item>
    <item><shape>
            <gradient android:angle="270" android:endColor="#151B8D" android:startColor="#151B8D" />

            <stroke android:width="1px" android:color="#000000" />

            <corners android:bottomLeftRadius="8dp" android:bottomRightRadius="0dp" android:topLeftRadius="0dp" android:topRightRadius="8dp" />

            <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
        </shape></item>

</selector>

这篇关于按钮像ImageView的android系统中点击效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆