Sep 4, 2012

Home Screen Widget step-by-step - resizeable home screen widget

It's part of the Home Screen Widgets step-by-step series.

Start from Android 3.1, API Level 12, support resizeable home screen widget. To specify a Home Screen Widget as resizeable, include android:resizeMode in App widget provider XML, /res/xml/widgetproviderinfo.xml in our example.

<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
    android:minWidth="146dp"
    android:minHeight="72dp"
    android:updatePeriodMillis="1800000"
    android:initialLayout="@layout/widget_layout"
    android:configure="com.example.androidhomewidget.ConfigureWidgetActivity"
    android:resizeMode="horizontal|vertical">
</appwidget-provider>


Resizeable Home Screen Widget


To resize the widget, touch-hold it to show its resize handles, then drag the horizontal and/or vertical handles to change the size on the layout grid.


No comments:

Post a Comment

Infolinks In Text Ads