gpt4 book ai didi

android - min API 以上的 xml 属性会导致 Android 崩溃吗?

转载 作者:行者123 更新时间:2023-11-29 15:45:14 24 4
gpt4 key购买 nike

或者这些属性是否会在 API 级别较低的设备上被忽略?

为什么我不能通过在 attributes min API 下启动一个模拟器来自己测试这个?这些模拟器都不适合我:https://code.google.com/p/android/issues/detail?id=195990

例如,如果我在 EditText 上使用 android:fontFamily="@string/sans_serif"(最小 API 为 16)属性并在 API 15 上运行应用程序设备,应用程序会崩溃还是属性会被忽略?

最佳答案

它只会被忽略.. 你可以用一个快速的 genymotion 模拟器仔细检查 https://www.genymotion.com/#!/download

http://developer.android.com/training/basics/supporting-devices/platforms.html#version-codes

Note: When parsing XML resources, Android ignores XML attributes that aren’t supported by the current device. So you can safely use XML attributes that are only supported by newer versions without worrying about older versions breaking when they encounter that code. For example, if you set the targetSdkVersion="11", your app includes the ActionBar by default on Android 3.0 and higher. To then add menu items to the action bar, you need to set android:showAsAction="ifRoom" in your menu resource XML. It's safe to do this in a cross-version XML file, because the older versions of Android simply ignore the showAsAction attribute (that is, you do not need a separate version in res/menu-v11/).

关于android - min API 以上的 xml 属性会导致 Android 崩溃吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34022195/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com