Android 圆角Button
生活随笔
收集整理的這篇文章主要介紹了
Android 圆角Button
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. 先在res/drawable中定義一個shape.xml文件,具體的顏色你可以自己調
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle" ><!-- 填充的顏色:這里設置背景透明 --><solid android:color="@android:color/transparent" /><!-- 邊框的顏色 :不能和窗口背景色一樣--><strokeandroid:width="3dp"android:color="#ffffff" /><!-- 設置按鈕的四個角為弧形 --><!-- android:radius 弧形的半徑 --><corners android:radius="5dip" /><!-- padding:Button里面的文字與Button邊界的間隔 --><paddingandroid:bottom="10dp"android:left="10dp"android:right="10dp"android:top="10dp" />
</shape>
------------------------------------------------------------------------
2. 在你的Activity的xml(比如activity_main.xml)中定義按鈕
<Buttonandroid:id="@+id/roundButton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/shape"android:text=" 圓角按鈕 " />
?
總結
以上是生活随笔為你收集整理的Android 圆角Button的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【转】mybatis实战教程(mybat
- 下一篇: ViewPager+Fragment实现