2012-03-03 20 views
4

由于错误日志建议使用drawable-*来提供密度优化的图像,所以我将/drawable的9个补丁文件移动到/drawable-hdpi当从/ drawable-hdpi而不是/ drawable加载为背景时,Drawable的大小不同/可绘制

问题是,AppWidget现在看起来不同。当Drawables存储在/drawable-hdpi边框更厚。

欲了解更多信息,比较所附的截图。这种差异的原因是什么?

截图

enter image description here

布局

<?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/widget_bg_default

enter image description here

widget_bg(存储在/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> 

回答

相关问题