簡體   English   中英

LinearLayout中視圖之間的意外間距

[英]Unexpected space between views in LinearLayout

我有以下布局:

<?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之間。 我已經將paddings / margins設置為0-不走運。 我該怎么辦?

嘗試此以獲取圖像視圖

<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"/>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM