is it possible to show widget only for a certain android version?

前端 未结 2 2141
名媛妹妹
名媛妹妹 2020-12-13 07:13

is it possible to show widget in \"Add to home screen > Widgets\" Dialog only for a certain android version without uploading two APKs and assigning to proper SDK version nu

2条回答
  •  借酒劲吻你
    2020-12-13 08:20

    I have a way to do it without any code e.g.:

    In your res\values dir create a bools.xml file:

    false

    Create a values-v11 dir (for honeycomb or above values), copy the file to it and set the value to true.

    Then in the manifest for the widget receiver use: android:enabled="@bool/honeycombOrAbove". I also used it in the configuration activity for the widget.

    This means the widget is disabled at install time.

提交回复
热议问题