是否有可能显示控件只在某个Android版本? [英] is it possible to show widget only for a certain android version?

查看:140
本文介绍了是否有可能显示控件只在某个Android版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是它可以显示小工具中的添加到主屏幕窗口小部件对话框只针对某一Android版本没有上传2的APK和分配适当的SDK版本号?

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 numbers?

推荐答案

我有办法做到这一点没有任何code,例如:

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

在你的资源\值目录创建一个bools.xml文件:

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

< XML版本=1.0编码=UTF-8&GT?; <资源>     <布尔名=honeycombOrAbove>假< /布尔> < /资源>

<?xml version="1.0" encoding="utf-8"?> <resources> <bool name="honeycombOrAbove">false</bool> </resources>

创建值-V11目录(用于蜂窝或以上的值),将文件复制到它并将其值设置为true。

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

然后在清单中的小部件接收器使用:Android的:启用=@布尔/ honeycombOrAbove。我还用它的插件的配置活动。

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.

这篇关于是否有可能显示控件只在某个Android版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆