I have created a widget fallowing multiple tutorials but I am having a bit of a problem getting the widget to fill the entire cell.
When I load the widget on a smaller screen like my Samsung Galaxy S it fills the entire cell space, but on my tablet there seems to be large margins or padding around the widget layout that prevent it from filling the entire cell, but many of my other widgets I have downloaded fill the entire 2x2 cell area on my tablet.
Here is code I am using for the widget size.
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="@layout/widget"
android:minHeight="146dp"
android:minResizeHeight="146dp"
android:minResizeWidth="146dp"
android:minWidth="146dp"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="10000" >
</appwidget-provider>
And the code for the widget layout itself:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:id="@+id/layout" android:background="@drawable/yellow">
<TextView android:id="@+id/TextView01" android:layout_width="match_parent"
android:layout_height="match_parent" style="@android:style/TextAppearance.Medium"
android:layout_gravity="center" android:textColor="#000000"></TextView>
</LinearLayout>
I also tried adding this into the manifest but it did not fix the problem
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
What am I missing that would cause my widget not to fill the entire cell area on a tablet?
Found the solution! You just have to add
<uses-sdk android:targetSdkVersion="8" />
into the manifest. Anything below targetSdk of 14 will work though and allow you to use the full cell area since the automatic padding to widgets wasn't implemented until Android 4.0 - api 14.