我有这个 LinearLayout:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="100dp"
android:layout_height="70dp"
android:src="@drawable/ic_launcher"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="100dp"
android:layout_height="30dp"
android:background="#FFD800"
android:textColor="@android:color/black"
android:gravity="center"
android:text="Text View"/>
</LinearLayout>
我想用圆角掩盖它,如下所示:
我尝试将其放入 FrameLayout 中,并在其顶部添加 shape.xml 的另一个布局,
但我得到最多的是:
or
我正在寻找一种使用 shape.xml 背景的方法,
但内边框是透明的,外边框是白色的。
我的形状.xml:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#FFFFFF">
</solid>
<stroke
android:width="2dp"
android:color="#000000" >
</stroke>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp">
</padding>
<corners
android:radius="50dp">
</corners>
</shape>
创建一个外部有白色圆角、中间透明的九个补丁(“逆九个补丁”),并将其放在 LinearLayout 的顶部。这是一种常见的做法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)