簡體   English   中英

RelativeLayout不必要的行內的ImageView

[英]ImageView inside a RelativeLayout unwanted line

我有一個具有以下結構的片段

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

    <TextView
        android:id="@+id/tv_title"
        style="?android:tileMode"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:minHeight="100dp"
        android:layout_alignParentTop="true"
        android:fontFamily="sans-serif-light"
        android:textSize="25sp"
        android:gravity="center"
        android:textColor="@android:color/white"
        android:textAlignment="center" />

    <ImageView
        android:id="@+id/iv_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_title"
        android:contentDescription="@string/image"
        android:layout_gravity="center_horizontal"
        android:adjustViewBounds="true"
        android:cropToPadding="false"
        android:scaleType="fitXY"/>

</RelativeLayout>

問題是在TextView和ImageView之間出現不必要的線條。
我嘗試了很多不同的位置和圖像嘗試,但是我無法使這條線消失。

順便說一下,所有這些都在一個Activity中,該Activity擴展了FragmentActivity。

在此處輸入圖片說明

該問題看起來像是典型的格式錯誤的9補丁

要編輯9補丁,我使用普通的圖形編輯器,然后使用draw9patch工具進行檢查。

深入了解9個補丁規則至關重要。
在這里找到有效的幫助。

顯然,如果在設置9個色標標記后縮放圖像,則會丟失它們,因為顏色將被混合(圖形工具傾向於應用抗鋸齒)。


另外,不要忘了正確設置9補丁,它必須是“視圖”或“布局”的背景 ,才能進行拉伸以適合。

暫無
暫無

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

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