I faced with a strange problem with my widget size. I decided to develop one simple widget with supporting of ldpi, mdpi, large-mdpi and hdpi screens. At first I created xml/widget.xml where I defined the following:
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minHeight="146dip"
android:minWidth="220dip"
android:updatePeriodMillis="0"
android:initialLayout="@layout/widget"/>
So I expect that my widget will take 3x2 cells for all supported screens. Then I designed several layouts, one for each screen type - ldpi, mdpi, large-mdpi and hdpi - where:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Widget"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
...
</RelativeLayout>
So I expect that the widget size will fit 3x2 cells for all screens, not more, not less. But currently when I run it on emulator (and real device too) I see that my widget takes more than a half of a screen for all supporting screens - 4x3 cells if to talk that the max size is 4x4 cells (as it described here: http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#sizes). Even if I'll define exact layout_width and layout_height in my widget layouts in dip it will still take 4x3 cells, just it's visible part will have another size.