国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > 互联网 > android里各种圆角设置

android里各种圆角设置

来源:程序员人生   发布时间:2014-06-26 22:31:00 阅读次数:2783次

有时候我们会需要圆角的按钮或者有圆角边框的edittext
那我们该怎么做呢?一般是建个xml:

这个shape.xml 代码来自网上,供大家参考
 

  1. xml version="1.0" encoding="UTF-8"?> 
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" 
  3.     android:shape="rectangle" > 
  4.      
  5.     <solid android:color="#02B4FE" /> 
  6.      
  7.      
  8.     <corners android:Radius="5dp" />    
  9. shape> 

OK了,但是,我需要一个只有右边上下两个角是圆角的按钮该怎么说?
其实这样改改就行了
 

  1. xml version="1.0" encoding="UTF-8"?> 
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" 
  3.     android:shape="rectangle" > 
  4.  
  5.      
  6.     <solid android:color="#02B4FE" /> 
  7.      
  8.      
  9.     <corners 
  10.           
  11.         android:topRightRadius="5dp" 
  12.         android:bottomRightRadius="5dp" 
  13.         android:topLeftRadius="5dp"   
  14.          android:bottomLeftRadius="5dp" 
  15.          /> 
  16.  
  17. shape> 

速记
android:topRightRadius 右上角
android:bottomRightRadius 右下角
android:topLeftRadius 左上角
android:bottomLeftRadius  左下角

生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生