這篇文章將為大家詳細講解有關Android如何制作圓角按鈕,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
創新互聯從2013年創立,先為平鄉等服務建站,平鄉等地企業,進行企業商務咨詢服務。為平鄉企業網站制作PC+手機+微官網三網同步一站式服務解決您的所有建站問題。具體內容如下
【主要步驟】
創建一個XML文件
以此文件作為Button的Background
1.創建XML文件
在res目錄下的drawable-mdpi下建立XML文件
button_frame_shape.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ffffff" /><!-- 填充的顏色 --> <!-- 設置按鈕的四個角為弧形 --> <!-- android:radius 弧形的半徑 --> <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" android:bottomRightRadius="5dp" android:bottomLeftRadius="5dp"/> <!-- 邊框粗細及顏色 --> <stroke android:width="2dp" android:color="@color/colorAccent" /> </shape>
2.使用
在Button下使用Android:background=”@drawable/button_frame_shape”
<?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"> <Button android:id="@+id/roundButton" android:text=" 圓角邊框按鈕 " android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/button_frame_shape" /> </LinearLayout>
效果如圖:
關于“Android如何制作圓角按鈕”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
標題名稱:Android如何制作圓角按鈕-創新互聯
當前URL:http://m.newbst.com/article30/hjeso.html
成都網站建設公司_創新互聯,為您提供搜索引擎優化、定制開發、自適應網站、軟件開發、網站建設、標簽優化
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯