gpt4 book ai didi

android - 从/drawable-hdpi 而不是/drawable 作为背景加载时 Drawable 的大小不同

转载 作者:太空宇宙 更新时间:2023-11-03 10:53:29 25 4
gpt4 key购买 nike

我将 9-patch 文件从 /drawable 移到了 /drawable-hdpi 因为错误日志推荐使用 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>

最佳答案

关于android - 从/drawable-hdpi 而不是/drawable 作为背景加载时 Drawable 的大小不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9547675/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com