1. 程式人生 > >android 控制元件背景新增圓角

android 控制元件背景新增圓角

在drawable建立一個xml檔案

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <!--圓角半徑--> 
    <corners android:radius="12dp"/> 
    <!--背景顏色,具體顏色自行在color檔案設定-->
    <solid android:color="@color/colorWhite"/>
</shape>

使用的時候把某個控制元件的background屬性設定為以上的drawable檔案