<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid android:color="#00A5C6"/>
<!-- 边缘线条颜色 -->
<stroke android:width="1.0px" android:color="#00A5C6"/>
<!-- 圆角的幅度 -->
<corners
android:topLeftRadius="10dip"
android:topRightRadius="10dip"
android:bottomLeftRadius="0dip"
android:bottomRightRadius="0dip"/>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid android:color="#00A5C6"/>
<!-- 边缘线条颜色 -->
<stroke android:width="1.0px" android:color="#00A5C6"/>
<!-- 圆角的幅度 -->
<corners
android:topLeftRadius="10dip"
android:topRightRadius="10dip"
android:bottomLeftRadius="0dip"
android:bottomRightRadius="0dip"/>
</shape>
使用时直接设置background就额可以了:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="20dip"
android:focusable="true"
android:clickable="true"
android:background="@xml/test_selector" >
</LinearLayout>
本文介绍如何使用XML定义自定义背景样式,包括设置内部颜色、边缘线条颜色及圆角幅度等属性,并提供了一个具体的LinearLayout背景配置示例。
961

被折叠的 条评论
为什么被折叠?



