-1
我的1x1小部件有问题。我一直在我的手机上测试我的应用程序,它是galaxy s3,当我为widget_provider.xml设置小部件比例如下:Android Widget高度和宽度指定
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minHeight="40dp"
android:minWidth="40dp"
android:initialLayout="@layout/widget"
android:previewImage="@drawable/volume_on_gr"
>
</appwidget-provider>
and widget.xml as;
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/phone_icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:clickable="true"
android:contentDescription="@string/toggler"
android:src="@drawable/volume_on"
/>
</FrameLayout>
我得到一个完美大小的小部件。然而,在屏幕较小的手机上,它会从边缘切割下来。在s3 mini上,它从左侧的尺寸被切割下来,并且从底部切割下来。所以我使用了fill_parent这两个属性,然后小部件看起来比它应该小。我有正确的大小不同的图标大小(mdpi,hdpi等)。感觉这是默认添加边际的问题,但我无法弄清楚如何改正它。我想要的是在每部手机上看起来相同或相似。
任何输入,将不胜感激。
@ShashidarManchu但我有自己的设计是一种体积更小,当我使用更大的那些图像将被损坏。任何方式来避免这种情况?或者让我们说,我有512x512图像,我做他们1920x1080,因为xxhdpi要求较低的分辨率(如果我是正确的,低于512)腐败会自行解决? – 2014-09-21 00:34:06