把粗线的两端圆成 xml 形状
round the two ends of thick line with xml shape
我有一个线条形状,是粗线:
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="30">
<shape android:shape="line">
<size
android:width="100dp"
android:height="100dp" />
<stroke
android:width="30dp"
android:color="#0000FF" />
</shape>
</rotate>
我想知道有什么方法可以使线的两端圆?
我试着把这个加到上面 <shape>
:
<corners android:radius="10dp"/>
但对粗线无效
在您的 xml
中添加一个 View tag
代表该行的类似内容。根据不同的线条粗细调整高度。
<View
android:layout_width="100dp"
android:layout_height="10dp"
android:background="@drawable/test"/>
然后像您所做的那样为其添加通常的背景
test.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#000000" />
<corners android:radius="8dip" />
</shape>
这首先给了我 没有开始标记 发现错误但是在 清理和重建 它产生了所需的输出。尝试一下。希望这可以帮助。
我有一个线条形状,是粗线:
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="30">
<shape android:shape="line">
<size
android:width="100dp"
android:height="100dp" />
<stroke
android:width="30dp"
android:color="#0000FF" />
</shape>
</rotate>
我想知道有什么方法可以使线的两端圆?
我试着把这个加到上面 <shape>
:
<corners android:radius="10dp"/>
但对粗线无效
在您的 xml
中添加一个 View tag
代表该行的类似内容。根据不同的线条粗细调整高度。
<View
android:layout_width="100dp"
android:layout_height="10dp"
android:background="@drawable/test"/>
然后像您所做的那样为其添加通常的背景
test.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#000000" />
<corners android:radius="8dip" />
</shape>
这首先给了我 没有开始标记 发现错误但是在 清理和重建 它产生了所需的输出。尝试一下。希望这可以帮助。