如何画一条有一个弯曲端的线
How to draw a line with one bending end
如何在XML文件中通过选择器绘制如上图所示的水平线(从左端向上弯曲)?下面是我的选择器文件代码。谢谢
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dip" android:color="@color/md_black_1000" />
<solid
android:color="#ffffff"
/>
<corners
android:topLeftRadius="15px"
android:bottomLeftRadius="15px"
/>
<padding
android:top="3dp"
android:bottom="3dp"
/>
</shape>
我相信你只能在特定情况下实现这种效果,例如,当你有固定的项目高度时:
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetTop="-2dp"
android:insetRight="-2dp">
<shape>
<corners android:bottomLeftRadius="80dp" />
<stroke android:width="2dp" />
</shape>
</inset>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="Item"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:background="@drawable/selector"/>
</FrameLayout>
然后:
如何在XML文件中通过选择器绘制如上图所示的水平线(从左端向上弯曲)?下面是我的选择器文件代码。谢谢
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dip" android:color="@color/md_black_1000" />
<solid
android:color="#ffffff"
/>
<corners
android:topLeftRadius="15px"
android:bottomLeftRadius="15px"
/>
<padding
android:top="3dp"
android:bottom="3dp"
/>
</shape>
我相信你只能在特定情况下实现这种效果,例如,当你有固定的项目高度时:
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetTop="-2dp"
android:insetRight="-2dp">
<shape>
<corners android:bottomLeftRadius="80dp" />
<stroke android:width="2dp" />
</shape>
</inset>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="Item"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:background="@drawable/selector"/>
</FrameLayout>
然后: