问题描述
我要创建一个1x1的Android窗口小部件。我已经设计了图像的每个屏幕像素密度如下:
I'm creating a 1x1 Android widget. I have designed images for each screen density as follows:
ldpi (120 DPI) = 72 * (120 / 160) == 54 x 54 pixels
mdpi (160 DPI) = 72 * (160 / 160) == 72 x 72 pixels
hdpi (240 DPI) = 72 * (240 / 160) == 108 x 108 pixels
xhdpi (320 DPI) = 72 * (320 / 160) == 144 x 144 pixels
我的小窗口规范:
My widget specification:
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="72dip"
android:minHeight="72dip"
android:updatePeriodMillis="1000"
android:initialLayout="@layout/widget">
</appwidget-provider>
在WVGA800屏幕(HDPI),小部件是1x1的。上WXGA800屏幕(MDPI),小部件是1x1的。在WXGA720屏幕(xhdpi),小部件的 2×2
On WVGA800 screens (hdpi), the widget is 1x1.On WXGA800 screens (mdpi), the widget is 1x1.On WXGA720 screens (xhdpi), the widget is 2x2.
有人点我在这里有什么问题的方向?
Can someone point me in the direction of what is wrong here?
推荐答案
的Android 4.0之前:(N * 74dip) - 2DIPhttp://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html
Before Android 4.0: (n * 74dip) - 2diphttp://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html
Android 4.0的:70×N - 30http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#anatomy
Android 4.0: 70 × n − 30http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#anatomy
还有Android的时候,它会自动添加填充:targetSdkVersion =14以上设置
There's also padding that is automatically added when android:targetSdkVersion="14 or higher" is set.
这篇关于1x1的Android部件显示为WXGA720屏幕上2x2的小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!