4

I moved 9-patch files from /drawable to /drawable-hdpi because the error log recommended to use drawable-* to offer density optimized images.

The problem is, that the AppWidget now looks different. When Drawables are stored in /drawable-hdpi the border is thicker.

For more information compare the attached screenshots. What is the reason for this difference?

Screenshot

enter image description here

Layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/widget_parent"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/widget_bg" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/widget_loading"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <ProgressBar
        style="?android:attr/progressBarStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginRight="4dp"
        android:layout_toLeftOf="@+id/textView1" />

</RelativeLayout>

Drawable @drawable/widget_bg_default

enter image description here

widget_bg (stored in /drawables)

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/widget_bg_default" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
    <item android:drawable="@drawable/widget_bg_pressed" android:state_pressed="true"/>
    <item android:drawable="@drawable/ic_launcher" android:state_selected="true"/>
    <item android:drawable="@drawable/widget_bg_focused" android:state_focused="true"/>

</selector>
Rayne
  • 2,620
  • 20
  • 28

1 Answers1

1

here is the explanation to the whole android drawable directory structure

Drawable-hdpi, Drawable-mdpi, Drawable-ldpi Android

also

http://wonton-games.blogspot.com/2010/07/tutorial-multiple-screen-support.html

Community
  • 1
  • 1
Mayank
  • 8,777
  • 4
  • 35
  • 60