Mutable android widget

Is there a way to make a resizable widget in android to fit the space on the main screen? For example, if the home screen is empty, I can make my own large widget. If there is another icon, I want to resize my widget, decreasing in accordance with the space remaining on the main screen.

Thanks.

+7
android widget
source share
2 answers

The usual practice that I have seen so far is to make several widgets of different sizes and let the user decide which size he prefers. I'm not sure there is an automated way to achieve this behavior!

+4
source share

With Android 3.1, it's now possible. Add the following to your appwidget-include element: Android: ResizeMode = "horizontal | vertical"

An example from the official documentation :

<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="294dp" android:minHeight="72dp" android:updatePeriodMillis="86400000" android:previewImage="@drawable/preview" android:initialLayout="@layout/example_appwidget" android:configure="com.example.android.ExampleAppWidgetConfigure" android:resizeMode="horizontal|vertical" > </appwidget-provider> 
+51
source share

All Articles