Android开发实现的圆角按钮、文字阴影按钮效果示例开发实现的圆角按钮、文字阴影按钮效果示例
本文实例讲述了Android开发实现的圆角按钮、文字阴影按钮效果。分享给大家供大家参考,具体如下:
效果图:
如果要实现圆角圆角图片,并变色须在drawable中配置背景文件如下:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 圆角深红色按钮 -->
<solid android:color="@color/RED"/>
<corners android:radius="15dip"/>
</shape>
</item>
<item android:state_pressed="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 圆角红色按钮 -->
<solid android:color="@color/PURPLE"/>
<corners android:radius="15dip"/>
</shape>
</item>
</selector>
三个按钮整体布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--文字带阴影的按钮-->
评论0
最新资源