你好,游客 登录 注册 搜索
背景:
阅读新闻

Android自定义ListView实现圆角

[日期:2012-07-25] 来源:csdn  作者:wangkuifeng0118 [字体:大 中 小]

如果是顶部第一项,则上面两个角为圆角,app_list_corner_round_top.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.          
  6.   
  7.        <gradient    
  8.        android:startColor="#B5E7B8"    
  9.        android:endColor="#76D37B"    
  10.        android:angle="270"   
  11.        />  
  12.           
  13.       <!--  <stroke android:width="1dip"   
  14.        android:color="@color/blue"   
  15.        />  -->  
  16.       <!--  <solid android:color="#FFeaeaea"  
  17.        />  -->  
  18.        <corners   
  19.            android:topLeftRadius="4dip"   
  20.            android:topRightRadius="4dip"   
  21.         
  22.        />  
  23. </shape> 

如果是底部最后一项,则下面两个角为圆角,app_list_corner_round_bottom.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.          
  6.   
  7.        <gradient    
  8.        android:startColor="#B5E7B8"    
  9.        android:endColor="#76D37B"    
  10.        android:angle="270"   
  11.        />  
  12.           
  13.       <!--  <stroke android:width="1dip"   
  14.        android:color="@color/blue"   
  15.        />  -->  
  16.       <!--  <solid android:color="#FFeaeaea"  
  17.        />  -->  
  18.        <corners   
  19.        android:bottomRightRadius="4dip"   
  20.        android:bottomLeftRadius="4dip"   
  21.         
  22.        />  
  23. </shape>   

如果是中间项,则应该不需要圆角, app_list_corner_round_center.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.          
  6.   
  7.        <gradient    
  8.        android:startColor="#B5E7B8"    
  9.        android:endColor="#76D37B"    
  10.        android:angle="270"   
  11.        />  
  12.           
  13.       <!--  <stroke android:width="1dip"   
  14.        android:color="@color/blue"   
  15.        />  -->  
  16.       <!--  <solid android:color="#FFeaeaea"  
  17.        />  -->  
  18.       <!--  <corners   
  19.        android:bottomRightRadius="4dip"   
  20.        android:bottomLeftRadius="4dip"   
  21.         
  22.        /> -->  
  23. </shape>   
linux
相关资讯       Android开发入门 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款