Resizable widget android

前端 未结 2 1326
旧巷少年郎
旧巷少年郎 2021-02-15 11:13

Is there any way we can make a resizable widget in android according to the space in home screen? For example if the home screen empty, i can make my large widget. If there oth

相关标签:
2条回答
  • 2021-02-15 11:53

    Common practice I have seen so far is to make several widgets in different sizes and let the user decide, which size he/she prefers. I am not sure, that there is an automated way to achieve this behavior!

    0 讨论(0)
  • 2021-02-15 12:04

    With Android 3.1 this is now possible Add the following to your appwidget-provide element android:resizeMode="horizontal|vertical"

    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>
    
    0 讨论(0)
提交回复
热议问题