gpt4 book ai didi

Android:来自早期 API 级别的可绘制资源

转载 作者:行者123 更新时间:2023-11-30 03:38:16 25 4
gpt4 key购买 nike

Android 中是否有一种方法可以使用来自较早 Android 版本/API 级别然后是当前项目的可绘制资源?更具体地说,有没有办法在项目中访问它而无需手动将其放入drawable资源文件夹?

在我的具体情况下,我想在使用 Android 4.0 的项目中使用来自 Android 2.2 的 android.R.drawable.btn_check_buttonless_on。因为在 4.0 中不再使用了,我显然不能像这样引用它

myMenuItem.setIcon(android.R.drawable.btn_check_buttonless_on);

是否有其他方法可以包含早期版本的可绘制资源?

最佳答案

我发现了这个:

https://androidcookbook.com/Recipe.seam;jsessionid=0443546CEE776318BF6D21552A9D1864?recipeId=3823

many (most?) of the resources are, for one reason or another, marked as non-public; presumably these are intended only for use by particular components. The non-public give a diagnostic that the "Resource is not public". You can still use the non-public one,s but you have to extract the image drawables and copy them into your project.

我也试试看

编辑:

它对我有用:

  1. 转到你的android SDK/platforms/android-19/
  2. 提取android.jar
  3. 转到android/res/
  4. 您拥有所有要使用的可绘制对象(在可绘制对象文件夹中)。

您必须将所有 .png 文件复制到您的项目中。

关于Android:来自早期 API 级别的可绘制资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16274088/

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