我制作的布局
我要实现的布局
orange_hollow_fill_round_corner.xml (自定义可绘制对象)
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dp" />
<stroke
android:width="1dp"
android:color="@color/orange" />
<size
android:width="80dp"
android:height="20dp" />
</shape>
我想使自定义可绘制对象如下所示,以便它不会剪切 Earned Badges 文本视图。
请忽略我的布局和我要实现的布局的边角和颜色差异。
答案 0 :(得分:4)
您可以通过将背景添加到textView(Earned Badges)来实现此目的,该背景的边角和黑色为android:background="@drawable/your_custom_button"
,它将与橙色鹳重叠。
我希望它能对您有所帮助。
答案 1 :(得分:0)
由于@noureldien穆罕默德(Mohamed)的方法目前似乎可行,但是如果您真的想像您提到的那样创建可绘制对象,则应尝试制作vector。这是您喜欢的一个。
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="326.33"
android:viewportHeight="76.25"
android:width="326.33dp"
android:height="76.25dp">
<path
android:pathData="M201.13 2h109.2c7.7 0 14 6 14 13.25V61c0 7.29 -6.3 13.25 -14 13.25H16c-7.7 0 -14 -6 -14 -13.25V15.25C2 8 8.3 2 16 2h92.42"
android:strokeColor="#FC7F2D"
android:strokeWidth="3"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
输出