做出仿iphone的圆角效果,以及shpe的各个属性

想要做出仿iphone的圆角效果其实很简单,定义一个shap就可以了

贴上代码

下面这个例子就是在ListViw的backGround设置成这个shap就可以了

 

<shape xmlns:android="http://schemas.android.com/apk/res/android">
 <!-- 实心  透明色
 <solid android:color="#FFFFFF"/>
 -->
 	<!--  这个属性是定义渐变效果的,angle是定义渐变的角度,必须是45的倍数-->
     <gradient
         android:startColor="@color/white"
         android:endColor="#f02345"
         android:angle="90" />
     <!--stroke 这个属性是定义边框的  -->
     <stroke
         android:width="2dp"
         android:color="#20B2AA" />
     <!--corner是模仿iphone的圆角效果  -->
     <corners
         android:radius="10dip" />
     <!--padding是内容距离边框的距离  -->
     <padding
         android:left="0dp"
         android:top="0dp"
         android:right="0dp"
         android:bottom="0dp" />
</shape>

在shape这个标签里面还有一个solid的属性,是填充用的

 

这里我是加在一个listView上的圆角边框 做出仿iphone的圆角效果,以及shpe的各个属性

 

你可能感兴趣的:(shap各个属性,iphone圆角边框)