ButtonStyle
:octocat:圆角,椭圆等按钮,不用再写shape文件。Rounded corners, oval buttons, no need to write shape files
Install / Use
/learn @laishujie/ButtonStyleREADME
ButtonStyle
圆角,椭圆等按钮,不用再写shape文件。Rounded corners, oval buttons, no need to write shape files
Step 1
Gradle
dependencies {
compile 'com.lai:buttonStyle:1.0.2'
}
Step 2
在布局上/In Layout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<!-- 快速配置type使用模板按钮 -->
<com.lai.library.ButtonStyle
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="5dp"
android:text="成功/Success"
app:type="ok"/>
<!-- 自定义按钮类型 -->
<com.lai.library.ButtonStyle
android:id="@+id/activity_btn_1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="@string/app_name"
app:normal_color="#F1F1F1"
app:press_color="#E9EEF2"
app:stroke_color="#CCCDD0"
app:stroke_width="1dp"/>
</LinearLayout>
预览/preview

XML 属性 /XML Attribute
<table> <tdead> <tr> <th align="center">属性/Attribute</th> <th align="center">介绍/introduce</th> </tr> </tdead> <tbody> <tr> <td align="center">type</td> <td align="center">根据固定的值快速配置出按钮: ok,info,warning,error</td> </tr> <tr> <td align="center">normal_color</td> <td align="center">默认颜色 /Default color</td> </tr> <tr> <td align="center">press_color</td> <td align="center">按下颜色/Press color</td> </tr> <tr> <td align="center">stroke_color</td> <td align="center">边框颜色 / stroke color</td> </tr> <tr> <td align="center">stroke_width</td> <td align="center">边框宽度 / stroke width</td> </tr> <tr> <td align="center">corner</td> <td align="center">圆角大小 / corner size</td> </tr> </tbody> </table>方法 Main Method
setPressedColor setNormalColor setCurrCorner setStrokeWidth setStrokeColor
更新日志 Update Logs
v1.0.2
- 新增type属性。增加模板配置按钮
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
