Android Widget Height and Width Specifying



I have a problem with my 1x1 widget. I have been testing my application on my phone which is galaxy s3 and when I set the widget proportions as follows for widget_provider.xml;



<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://ift.tt/nIICcg"
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://ift.tt/nIICcg"
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>


I get a perfectly sized widget. However on phones with smaller screens it gets cut from the edges. On s3 mini it gets cut from the left size and on nexus it got cut from the bottom. So I used fill_parent for both properties and then widget looks smaller than it should. I have all the icons sized correctly for different sizes (mdpi, hdpi etc). It feels like it is an issue of margins added by default but I cant figure out how to correct it. What I want is on every phone to look the same or similar.


Any input would be appreciated.


No comments:

Post a Comment