-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