我在地图片段中添加了边框。拐角也变圆了。但是问题是片段背景仍然出现在角落中。它只是使整个设计看起来很奇怪。可以克服吗?我还附有我的应用程序中出现的问题的屏幕截图。因此,我希望在这方面提供任何帮助。
这里是我用来实现问题中说明的设计的地图代码,因此可以很好地理解问题。
**activity_maps.xml:**
<RelativeLayout
android:layout_weight=".5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/map_border_2"
android:orientation="vertical">
</LinearLayout>
</RelativeLayout>
Code for implementing the borders is given Below.
**map_border_2.xml (Drawable file):**
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:gradientRadius="2dp" />
<stroke
android:color="@color/glass"
android:width="10dp" />
<corners
android:radius="10dp" />
</shape>
</item>
</selector>
In the above code, I need to remove the map fragment background from the four corners. I have added some buttons on the map but I have no issue in that!
上面的图像是我的代码的输出。在上图中,需要删除带圆圈的地方。
尝试将此行添加到RelativeLayout
或fragment
android:background="@drawable/map_border_2"
我希望它将与您合作