我有以下布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:id="@+id/fragment_send_imageView"
android:layout_margin="0dp"
android:padding="0dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:padding="0dp"
android:layout_margin="0dp">
<com.google.android.gms.maps.MapView
android:id="@+id/fragment_send_mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</LinearLayout>
在我的设备上它看起来像这样:
如您所见,有两个“分隔线”——一个在应用程序窗口的上边框和 ImageView 之间,第二个在 ImageView 和 MapView 之间。我已将填充/边距设置为 0 - 运气不好。我该怎么办?
最佳答案
为你的 ImageView 试试这个
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:id="@+id/fragment_send_imageView"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:padding="0dp"/>
关于android - LinearLayout 中 View 之间的意外空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22010947/