android 使用shape自定义圆角矩形
? ? ? ?今天項目中需要用到圓角矩形邊框,就自己定義了一個,雖然很簡單,但也記錄一下。
? ? ? ?在eclipse中新建shape文件步驟:
? ? ? ? 1.選中res下面的drawable目錄,點擊鼠標右鍵New->Android Xml File。
????????2.Resource Type選中Drawable,Root Element選中shape。
<shape xmlns:android="http://schemas.android.com/apk/res/android" ?>
? ? <!-- 填充的顏色 -->
? ? <!-- ?<solid android:color="#04AEC7" />-->
? ? <!-- 設置邊框寬度 -->
? ? <stroke android:width="1dp" android:color="#999999"/>
? ??
? ? <!-- 四個角的弧度 -->
? ? <corners
? ? ? ? android:bottomLeftRadius="5dp"
? ? ? ? android:bottomRightRadius="5dp"
? ? ? ? android:topLeftRadius="5dp"
? ? ? ? android:topRightRadius="5dp" />
? ? <!-- padding:TextView里面的文字與TextView邊界的間隔 -->
? ? <padding
? ? ? ? android:bottom="5dp"
? ? ? ? android:left="2dp"
? ? ? ? android:right="2dp"
? ? ? ? android:top="5dp" />
? ? <!-- <size android:width="100dp" android:height="45dp"/> -->
</shape>
總結
以上是生活随笔為你收集整理的android 使用shape自定义圆角矩形的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: L2_024部落
- 下一篇: [搬家from qzone] 读书笔记