首页 > 其他 > 详细

xml 实现圆形图 和 椭圆形图

时间:2015-12-01 12:36:50      阅读:323      评论:0      收藏:0      [点我收藏+]

1. 效果图

技术分享

2.圆形图

<ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:background="@drawable/bg_btn_round" />

bg_btn_round.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >

    <solid android:color="@android:color/white" />

    <size
        android:height="30dp"
        android:width="30dp" />
    <stroke android:width="1dp" 
        android:color="@color/grey"/>

</shape>

2. 椭圆形图

<ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:background="@drawable/bg_btn_oval_gray" />

bg_btn_oval_gray.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <corners  
        android:topLeftRadius="15dp"
        android:topRightRadius="15dp"
        android:bottomRightRadius="15dp"
        android:bottomLeftRadius="15dp"/>
    <solid android:color="@color/bg_btn_oval_gray" />
 
    <size
        android:height="30dp"
        android:width="80dp" />
    <stroke android:width="1dp" 
        android:color="@color/grey"/>

</shape>

3. 实现蓝色效果,把<solid>的颜色改为蓝色就可以了

xml 实现圆形图 和 椭圆形图

原文:http://www.cnblogs.com/520-1314/p/5009575.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!