I have in my xml an element from a third party library. Let say that it is a specific button named "SuperButton":
<com.library.SuperButton
android:id="@+id/my_super_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
My project should run on Android 2.1 but my SuperButton is only designed for Android 2.2 and higher (Froyo). What should I add in my xml to make sure that the SuperButton will be ignored (and consequently not displayed ; and will not crash the app...) on Android 2.1 ?
Thanks !!!
You'll have to create two layout files. Put the 2.1 version in the /res/layout/ folder and the 2.2+ version in the /res/layout-v8/ folder.
Now everything with API level 8 or higher (see http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels ) will take the xml from the layout-v8 folder. Everything else from the default folder.
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.