圆角,椭圆等按钮,不用再写shape文件。Rounded corners, oval buttons, no need to write shape files
dependencies {
compile 'com.lai:buttonStyle:1.0.2'
}
<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>
属性/Attribute | 介绍/introduce |
---|---|
type | 根据固定的值快速配置出按钮: ok,info,warning,error |
normal_color | 默认颜色 /Default color |
press_color | 按下颜色/Press color |
stroke_color | 边框颜色 / stroke color |
stroke_width | 边框宽度 / stroke width |
corner | 圆角大小 / corner size |
setPressedColor setNormalColor setCurrCorner setStrokeWidth setStrokeColor
- 新增type属性。增加模板配置按钮