简体   繁体   中英

Static Android homescreen widget

I´ve developed an android application with it´s own widget.

To bring the widget in the right form, I set minWidth to 300dp and minHeight to 400 dp.

When placing it to the homescreen, it has the right dimensions, but anyway, it´s possible to resize it into any form you want, even 1x1 cells, which should be prevented by setting minWidth and minHeight.

How could you make the widget non-resizable?

in your widget properties, set android:resizeMode="none"

Example:

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
    android:initialLayout="@layout/widget_layout"
    android:minHeight="72dp"
    android:minWidth="72dp"
    android:previewImage="@drawable/widget_preview"
    android:resizeMode="none"
    android:updatePeriodMillis="60000" >
</appwidget-provider>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM