Android 从线性布局的指定区域显示的颜色
我一直在构建一个圆角的线性布局。指定给拐角的半径为15 dp。然而,白色仍然在角落里显现出来。已附上图片以寻求帮助Android 从线性布局的指定区域显示的颜色,android,android-studio,android-fragments,Android,Android Studio,Android Fragments,我一直在构建一个圆角的线性布局。指定给拐角的半径为15 dp。然而,白色仍然在角落里显现出来。已附上图片以寻求帮助 Main XML File: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-a
Main XML File:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bottom_menu_shape"
>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android" >
<item >
<shape android:shape="rectangle" >
<corners
android:topLeftRadius="25dp"
android:topRightRadius="25dp"
/>
<stroke android:width="1dip" android:color="#00249C"/>
</shape>
</item>
</selector>
可以使用图层列表,方法是将另一个图层放置在圆角矩形后面,并将其设置为所需的任何颜色。我在这里用深红色来演示
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle"
android:tint="@android:color/holo_red_dark">
</shape>
</item>
<item >
<shape android:shape="rectangle"
android:tint="@android:color/white">
<corners
android:topLeftRadius="25dp"
android:topRightRadius="25dp"
/>
<stroke android:width="1dip" android:color="#00249C"/>
</shape>
</item>
您可以使用图层列表,方法是在圆角矩形后面放置另一个图层,并将其设置为所需的任何颜色。我在这里用深红色来演示
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle"
android:tint="@android:color/holo_red_dark">
</shape>
</item>
<item >
<shape android:shape="rectangle"
android:tint="@android:color/white">
<corners
android:topLeftRadius="25dp"
android:topRightRadius="25dp"
/>
<stroke android:width="1dip" android:color="#00249C"/>
</shape>
</item>