当前位置:首页 > 如何产生圆角边框线的的效果-android

如何产生圆角边框线的的效果-android

点击次数:2918  更新日期:2013-07-05

android中如何产生圆角边框线的的效果:

在drawable下面新建一个xml文件,内容如下,然后将控件的backgroud设置为这个 background="@drawable/xxx.xml"


<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android" >

   <item android:state_pressed="true">

       <shape>    

   <solid android:color="#50ffffff" />    

   <corners android:radius="5dp"/>

   <stroke android:width="1px" android:color="#ff000000"/>  

</shape>

   </item>

<item android:state_pressed="false">

   <shape>    

   <solid android:color="#afffffff" />    

   <corners android:radius="5dp"/>    

   <stroke android:width="1px" android:color="#ff000000"/>

</shape>

</item>

</selector>