android圆角按钮的实现
生活随笔
收集整理的這篇文章主要介紹了
android圆角按钮的实现
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1在res目錄下的drawable-mdpi建立xml文件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="#FFFFFF" /><!-- 設(shè)置按鈕的四個(gè)角為弧形 --><!-- android:radius 弧形的半徑 --><corners android:radius="5dip" /><!-- padding:Button里面的文字與Button邊界的間隔 --> <padding android:left="10dp"android:top="10dp"android:right="10dp"android:bottom="10dp" /> </shape>3使用時(shí),在用到的地方的xml文件里這么寫(xiě)
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent"android:layout_height="wrap_content"android:text="@string/hello"/> <Button android:id="@+id/roundButton"android:text=" 圓角按鈕 "android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/shape"/> </LinearLayout>總結(jié)
以上是生活随笔為你收集整理的android圆角按钮的实现的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: android录音功能的实现
- 下一篇: 反编译apk文件教程(查看java代码篇