• android 按钮点击效果实现


    在其他人的博客里看到其实实现按钮点击效果的方法有很多,这里提到的只是其中一个办法

    图片素材(我自己用截图截的,可以自己搞)

    放到mipmap目录下(studio是在这个目录下 , eclipse 直接放在drawable下)

    在drawable目录下创建一个btn_select.xml 文件

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:state_pressed="false"
            android:drawable="@mipmap/black"/>
        <item android:state_pressed="true"
            android:drawable="@mipmap/blue"/>
    </selector>

    在布局的时候用background调用该文件就行了

    调用方法:

     <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageButton"
            android:background="@drawable/btn_selector"
            android:layout_above="@+id/button2"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="113dp" />
  • 相关阅读:
    Sqli-labs less 12
    Sqli-labs less 13
    Sqli-labs less 14
    Python3之collections模块
    Python3之 contextlib
    Python3之sqlalchemy
    Python3之RabbitMQ
    Python3之redis使用
    Python3之Memcache使用
    python自动化开发学习 进程, 线程, 协程
  • 原文地址:https://www.cnblogs.com/wobeinianqing/p/5337521.html
Copyright © 2020-2023  润新知