android button 按钮,设置左/右小图标,与文字居中距离

参考博客地址

功能点
  • 支持自定义图标与文字的距离
  • 支持小图标宽高自定义
  • 支持左右自定义小图标
复制代码
maven { url 'https://jitpack.io' }
implementation 'com.github.CMzhizhe:AppCompatButtonProject:1.0.0'

 <com.gxx.buttonlibrary.DrawableCenterButton
        android:layout_marginTop="10dp"
        android:clickable="true" 
        android:layout_width="172dp"
        android:layout_height="55dp"
        app:dl_dis="10dp" //文字图片距离
        app:dl_width="30dp" //宽高
        app:dl_height="30dp"
        android:gravity="center" //居中
        android:background="@drawable/ripple_c899fc_solid_7904fd_radius_50"
        android:drawableStart="@drawable/down" //设置左边,右边就用 android:drawableRight
        android:text="Download"
        android:textColor="@color/white"
        android:textSize="18sp" />
相关推荐
每次的天空3 分钟前
Android-自定义View的实战学习总结
android·学习·kotlin·音视频
移动开发者1号12 小时前
使用 Android App Bundle 极致压缩应用体积
android·kotlin
移动开发者1号12 小时前
构建高可用线上性能监控体系:从原理到实战
android·kotlin
恋猫de小郭1 天前
Meta 宣布加入 Kotlin 基金会,将为 Kotlin 和 Android 生态提供全新支持
android·开发语言·ios·kotlin
androidwork1 天前
深入解析内存抖动:定位与修复实战(Kotlin版)
android·kotlin
heeheeai1 天前
kotlin 通道trysend方法
android·开发语言·kotlin
移动开发者1号1 天前
ReLinker优化So库加载指南
android·kotlin
移动开发者1号1 天前
剖析 Systrace:定位 UI 线程阻塞的终极指南
android·kotlin
移动开发者1号1 天前
深入解析内存抖动:定位与修复实战(Kotlin版)
android·kotlin
Try0211 天前
Kotlin中Lambda表达式妙用:超越基础语法的力量
kotlin