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" />
相关推荐
alexhilton13 小时前
端侧RAG实战指南
android·kotlin·android jetpack
Kapaseker1 天前
2026年,我们还该不该学编程?
android·kotlin
Kapaseker2 天前
一杯美式搞懂 Any、Unit、Nothing
android·kotlin
Kapaseker3 天前
一杯美式搞定 Kotlin 空安全
android·kotlin
FunnySaltyFish4 天前
什么?Compose 把 GapBuffer 换成了 LinkBuffer?
算法·kotlin·android jetpack
Kapaseker4 天前
Compose 进阶—巧用 GraphicsLayer
android·kotlin
Kapaseker5 天前
实战 Compose 中的 IntrinsicSize
android·kotlin
A0微声z7 天前
Kotlin Multiplatform (KMP) 中使用 Protobuf
kotlin
alexhilton8 天前
使用FunctionGemma进行设备端函数调用
android·kotlin·android jetpack
lhDream8 天前
Kotlin 开发者必看!JetBrains 开源 LLM 框架 Koog 快速上手指南(含示例)
kotlin