但是即使地图背景的父布局有角,我也会得到矩形地图,我的代码是,
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/white_bg"
>
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
</RelativeLayout>
我的 white_bg 代码是,
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Background Color -->
<solid android:color="@color/white_color" />
<!-- Border Color -->
<stroke
android:width="2dp"
android:color="@color/white_color" />
<!-- Round Corners -->
<corners
android:topLeftRadius="@dimen/_12sdp"
android:topRightRadius="@dimen/_12sdp" />
</shape>
请帮我摆脱这个问题
最后使用卡片视图解决,
这是我的解决方案,这可能会帮助某人
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/white_bg">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="@dimen/_10dp"
android:layout_marginBottom="-10dp"
>
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.cardview.widget.CardView>
</RelativeLayout >
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句