JuHyun Lee
JuHyun Lee

Reputation: 139

Android 9patch image shows difference result each devices

I have two devices Nexus5 and LG G3.

In same project, nine patch image shows difference result.

This small image is the nine patch that file name is 'main_ground_bg.9.png' -> enter image description here

The image is white and has gray border where top, bottom.

And results are...

Nexus 5 works well.

enter image description here

But LG G3 devices shows gray...

enter image description here

I putted the ninepatch image on 'drawable-xxhdpi' folder

and xml source is below code.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:background="#FFFFFFFF"
tools:context=".MyActivity">

<ImageView
    android:text="@string/hello_world"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:background="@drawable/main_ground_bg" />

</RelativeLayout>

Upvotes: 0

Views: 117

Answers (1)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75778

Please check this link .Use This

 <ImageView
      android:layout_width="100dp"
      android:layout_height="100dp"
      android:scaleType="fitXY"
      android:adjustViewBounds="true"
      android:src="@drawable/main_ground_bg" />

Upvotes: 1

Related Questions