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" />
相关推荐
Goway_Hui13 小时前
【KMP for OpenHarmony】-- 在鸿蒙工程中使用 Apollo-Kotlin
华为·kotlin·harmonyos
释厄62315 小时前
AI 军备竞赛悖论——为 AI 卖游戏但 AI 需要游戏母场景
人工智能·游戏·kotlin
D e re k ZH16 小时前
保序回归:从 PAVA 到可并堆的单调约束优化
c++·算法·数据挖掘·回归·kotlin
Goway_Hui17 小时前
【KMP for OpenHarmony】Cache4k 0.14.0 鸿蒙适配
华为·kotlin·harmonyos
YB137518 小时前
kotlin与函数式编程
kotlin
我是唐青枫1 天前
Kotlin Delegation 委托详解
开发语言·kotlin
唐青枫2 天前
Kotlin Inheritance(继承)详解:语法、原理、实战 Demo
kotlin
alexhilton2 天前
用Konsist与Lint强制执行设计系统契约
android·kotlin·android jetpack
唐青枫2 天前
Kotlin Delegation 委托详解
kotlin
传奇开心果4 天前
Compose Multiplatform 共享边界实战:架构契约、互操作同步与可回退设计
android·kotlin