2024年5月25日发(作者:)

android 画虚线、实线,画圆角矩形,一半圆角

建立dotted_line_文件放在drawable文件夹下面。

android:shape="line" 可以修改你想要的形状

android:shape="line">

android:dashWidth="2dp" android:dashGap="3dp" />

然后在布局的xml里面:

作为ImageView或者Linearlayout等作为背景源就可以了。

android:id="@+id/activity_line"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="5dip"

android:layout_marginRight="5dip"

android:background="@drawable/dotted_line_gray" />

---------

2、画圆角矩形

建立 rect_文件放在drawable文件夹下面。

android:shape="rectangle">

然后在布局的xml里面:

作为ImageView或者Linearlayout等作为背景源就可以了。

android:id="@+id/activity_myhezu_wantchuzu"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="@drawable/myhezu_dottedline_rect_green"

android:orientation="horizontal" >

3、一半圆角:

android:shape="rectangle">

android:topRightRadius="16dp"

android:bottomLeftRadius="0dp"

android:bottomRightRadius="0dp"/>

android:endColor="#ffffff"

android:angle="270"/>

android:color="#80000000" />