I am targeting 1.6 but I would like to have nice widget that can use stackview and other improvement Android SDK provides for widget if user is on 3.0 above device. and a plain widget on 1.6-2.3/
我应怎样做这两个版本的植被?
感谢很多人
I am targeting 1.6 but I would like to have nice widget that can use stackview and other improvement Android SDK provides for widget if user is on 3.0 above device. and a plain widget on 1.6-2.3/
我应怎样做这两个版本的植被?
感谢很多人
我的建议:
创建两种植被,利用资源价值方法实现/处置。
转口/价值/包料:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="atLeastHoneycomb">false</bool>
<bool name="notHoneycomb">true</bool>
</resources>
页: 1
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="atLeastHoneycomb">true</bool>
<bool name="notHoneycomb">false</bool>
</resources>
注:
<receiver android:name="MyOldAppWidgetProvider"
android:enabled="@bool/notHoneycomb">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/example_oldappwidget_info" />
</receiver>
<receiver android:name="MyNewAppWidgetProvider"
android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/example_newappwidget_info" />
</receiver>
您可在res
上打分。 特定目录,添加像<代码>-v11这样的斜体。
例如,将你的布局称为main.xml
。 可在<代码>layout/code>上填上你的1.6-2.3码>main.xml文档,然后将新的正文(main.xml
文档列入layout-v11
。 在使用Honeycomb和编造时,填写在-v11
。 请参看R.layout.main
等你的档案时选择文件夹。
从那以后,您的活动中可以有某种逻辑,即检查您的新植被物的存在(或仅检查Build.VERIONS
For more details on this, check out the Qualifier name rules from the Android documentation.
You can check the device api version like:
int apiLevel = android.os.Build.VERSION.SDK_INT;
从复印件的水平来看,如果是,你可以用来为不同的复印件/照片装上不同的布局。
I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...
I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...
I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...
I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...
To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?
When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...
I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...
I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...