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 中,它扩展了 FragmentActivity。

这个问题看起来像是一个典型的格式错误的 9 补丁程序

要编辑一个 9 补丁,我使用普通的图形编辑器,然后用 draw9patch 工具检查它。

深入了解 9 个补丁规则至关重要。
查找有效帮助 here.

显然,如果在设置 9 个补丁标记后缩放图像,您会丢失它们,因为颜色会混合(图形工具倾向于应用抗锯齿)。


此外,不要忘记正确设置 9 补丁,它必须是视图或布局的背景,以便拉伸以适合。