可拉出的三角孔
Triangle hole with drawable
B(白色)布局在 A(图像)布局之上,我需要裁剪背景才能得到这个结果。
可绘制对象可以吗?
如果不是,其他解决方案是什么?
这是我使用的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/gradient_back"
android:layout_width="match_parent"
android:layout_height="166dp"
>
<TextView
android:id="@+id/txtWhiteStripe"
android:background="@drawable/white_stripe"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="(B) Some text here"
android:textStyle="bold"
android:textColor="#f00"
android:textSize="16sp"
/>
</RelativeLayout>
要得到这个结果 - 好吧,只是一个 proof of a concept
,在这里:它可能不是有史以来最吸引人的图形......;)
我用的图片是:
背景 (gradient_back.png) - 我本可以使用单行,但是......好吧我做了一个完整的图像
和白色条纹 (white_stripe.9.png) - 这是概念中最有趣的部分
不幸的是,它几乎是看不见的,因为它在白色背景上是全白透明的。
不过在9补丁工具里确实像这个:
我应该稍微限制内容的底部填充 - 但是,好吧,通过从右侧移除一些黑色像素很容易做到。
尽情享受吧。
B(白色)布局在 A(图像)布局之上,我需要裁剪背景才能得到这个结果。
可绘制对象可以吗? 如果不是,其他解决方案是什么?
这是我使用的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/gradient_back"
android:layout_width="match_parent"
android:layout_height="166dp"
>
<TextView
android:id="@+id/txtWhiteStripe"
android:background="@drawable/white_stripe"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="(B) Some text here"
android:textStyle="bold"
android:textColor="#f00"
android:textSize="16sp"
/>
</RelativeLayout>
要得到这个结果 - 好吧,只是一个 proof of a concept
,在这里:它可能不是有史以来最吸引人的图形......;)
我用的图片是:
背景 (gradient_back.png) - 我本可以使用单行,但是......好吧我做了一个完整的图像
和白色条纹 (white_stripe.9.png) - 这是概念中最有趣的部分
不幸的是,它几乎是看不见的,因为它在白色背景上是全白透明的。
不过在9补丁工具里确实像这个:
我应该稍微限制内容的底部填充 - 但是,好吧,通过从右侧移除一些黑色像素很容易做到。
尽情享受吧。