Mask layout with rounded corner xml shape

笑着哭i 提交于 2019-12-06 03:20:28

Create a nine-patch with white rounded corners outside, transparent in the middle, ("inverse nine-patch") and put it on top on your LinearLayout. This is a common practice.

Tried out below xml file

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <stroke
        android:width="1dp"
        android:color="#4a6176" />

    <padding
        android:left="10dp"
        android:right="10dp"
         />

    <corners android:radius="6dp" />

</shape>

Just remove <solid> tag from your shape. Then apply that shape to the background of your LinearLayout.

Because the <solid> tag specifies the fill color of your shape. Without that tag the center of your shape will be fully transparent. So it will look just like a border.

make your layout background like this: android:background="@drawable/shape"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!