0

I have a fragment with the following structure

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

The problem is that an unwanted line appears between the TextView and the ImageView.
I tried a lot of different atempts with the position and the image, but I can not make this line disappear.

By the way, all this is inside an Activity which extends a FragmentActivity.

enter image description here

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
agusgambina
  • 6,229
  • 14
  • 54
  • 94
  • 1
    Can you post a picture please? It will help me to diagnose what line you are referring to. – edwoollard Aug 10 '15 at 22:53
  • What's in the tileMode style for your TextView? Is your tileMode style syntax correct? – joshgoldeneagle Aug 10 '15 at 22:55
  • Thank you @edwoollard I just uploaded. – agusgambina Aug 10 '15 at 23:11
  • Thank you @joshgoldeneagle I think that was not suppose to be there. – agusgambina Aug 10 '15 at 23:11
  • 4
    Are you using a **9 patch**? Because this really looks like a typical `malformed 9 patch`. – Phantômaxx Aug 10 '15 at 23:41
  • 1
    Thank you @FrankN.Stein for your quick answer. I used 9 patch to generate the images. I think you are right. There is a known fix to this or an alternative to generate the images automatically? thank you – agusgambina Aug 11 '15 at 13:51
  • 1
    I use a normal graphics editor, then check it with the draw9patch tool. Knowing the 9 patches rules in depth is crucial. Find a valid help [here](http://radleymarx.com/blog/simple-guide-to-9-patch/). Obviously, if you scale an image AFTER you have set the 9 patch markers, you'll lose them, because the colors will be blended (for antialiasing). – Phantômaxx Aug 11 '15 at 13:52
  • 1
    Excellent, thank you, the solution was editing with a graphic tool and checking with the draw9patch. @FrankN.Stein please post as an answer and I will mark as the correct answer. – agusgambina Aug 11 '15 at 14:16

1 Answers1

1

This issue looks like a typical malformed 9 patch.

To edit a 9 patch, I use a normal graphic editor, then check it with the draw9patch tool.

Knowing the 9 patches rules in depth is crucial.
Find a valid help here.

Obviously, if you scale an image AFTER you have set the 9 patch markers, you'll lose them, because the colors will be blended (graphic tools tend to apply antialiasing).


Also, don't forget that to set the 9 patch correctly, it has to be the background of the View or Layout, in order to be stretched to fit.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115