当前位置: 代码迷 >> Android >> android shape 花的圆,三个View当用了这个shape,出现一个
  详细解决方案

android shape 花的圆,三个View当用了这个shape,出现一个

热度:164   发布时间:2016-04-28 01:53:39.0
android shape 花的圆,三个View应用了这个shape,出现一个
本帖最后由 jeabo 于 2015-03-20 17:30:27 编辑
布局代码如下:

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:orientation="horizontal" >

        <View
            android:id="@+id/guide_v_first"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/guide_buttom_style" />

        <View
            android:id="@+id/guide_v_secend"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/guide_buttom_style" />

        <View
            android:id="@+id/guide_v_thrid"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/guide_buttom_style" />
    </LinearLayout>


shape代码如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadius="15dp"
    android:innerRadiusRatio="1"
    android:shape="ring"
    android:thickness="0dp"
    android:thicknessRatio="2"
    android:useLevel="false" >

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

    <stroke
        android:width="0.1dp"
        android:color="@color/lightpink" />

</shape>


出现的效果却是


就一个我用的是线性布局啊,跪求大神
------解决思路----------------------
引用:
布局代码如下:

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:orientation="horizontal" >

        <View
            android:id="@+id/guide_v_first"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/guide_buttom_style" />

        <View
            android:id="@+id/guide_v_secend"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/guide_buttom_style" />

        <View
            android:id="@+id/guide_v_thrid"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/guide_buttom_style" />
    </LinearLayout>


shape代码如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadius="15dp"
    android:innerRadiusRatio="1"
    android:shape="ring"
    android:thickness="0dp"
    android:thicknessRatio="2"
    android:useLevel="false" >

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

    <stroke
        android:width="0.1dp"
        android:color="@color/lightpink" />

</shape>


出现的效果却是


就一个我用的是线性布局啊,跪求大神

用 android:layout_weight="1"设置占据比例就好了
------解决思路----------------------
楼上正解,注意加上 android:layout_width="0dp"。
  相关解决方案