I have Android widget that contains two buttons. But i have no idea how big my widget should be for different DPI. According to this, it’s easy to calculate, but my widget isn’t square, it’s rectangle, how to calculate it’s size?
My widget-provider.xml looks like this:
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="160dip"
android:minHeight="72dip"
android:updatePeriodMillis="0"
android:initialLayout="@layout/main"
/>
Since you’re using dip units, it will be automatically scaled by the system according to the pixel density. (The widget will always be scaled to the same physical size, regardless of pixel density.) The reference density that the system uses for scaling is 160 pixels/inch.