Android快速开发
颜色
<color name="colorPrimary">#33aaff</color>
<color name="colorPrimaryDark">#2299ee</color>
<color name="colorPrimaryOverlay">#cc0094ff</color>
<color name="colorAccent">#FF4081</color>
Toolbar
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimaryDark"
app:title="Title"
app:titleTextColor="#FFF"
app:navigationIcon="?attr/homeAsUpIndicator"
>
</android.support.v7.widget.Toolbar>
按钮
btn_normal.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorPrimary"/>
<corners android:radius="5dp"/>
<padding android:top="2dp" android:bottom="2dp"/>
</shape>
btn_pressed.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorPrimaryDark"/>
<corners android:radius="5dp"/>
<padding android:top="2dp" android:bottom="2dp"/>
</shape>
btn_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/btn_pressed"/>
<item android:drawable="@drawable/btn_normal"/>
</selector>
引用
<Button
android:onClick="test"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/btn_selector"
android:text="测试"
android:textColor="#FFF"
android:textSize="16sp"
android:textAllCaps="false"
/>
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/02/26/android-fast-development/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Android快速开发
颜色
<color name="colorPrimary">#33aaff</color>
<color name="colorPrimaryDark">#2299ee</color>
<color……
文章目录
关闭
共有 0 条评论