Android 可拉深三角孔
B(白色)布局在A(图像)布局之上,我需要裁剪背景以便得到这个结果 这是不是可以用抽绳呢?Android 可拉深三角孔,android,overlay,crop,android-drawable,Android,Overlay,Crop,Android 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"
如果没有,其他解决方案是什么?这是我使用的布局:
<?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>
为了得到这个结果-好吧,这里只是一个概念的证明:它可能不是有史以来最吸引人的图形…;)
我使用的图片是:
背景(gradient_back.png)-我可以用一行,但是。。。我拍了一张完整的照片
还有白色条纹(white_stripe.9.png)——这是概念中最有趣的部分
不幸的是,它几乎是看不见的,因为它是白色的,透明的,背景是白色的
但在9补丁工具中,它看起来确实像这样:
我应该限制一下内容底部的填充,但是,好吧,从右侧移除一些黑色像素很容易做到
享受。试试这个解决方案:-“B”只是ImageView中的一个白色叠加图像(9个补丁),中间上方有一个透明的切口。Thx@FrankN.Stein,也许你可以发布一个更详细的答案,这样我可以为未来的开发者验证它?