你能告诉我如何使用 android 的图标 expander_ic_maximized 吗? 我发现在 frameworks/base/core/res/res/drawable-hdpi/expanderic_minimized.9.png
这是我的布局 xml 文件:
<ImageView android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/expander_ic_minimized">
但是我得到这个错误:
res/layout/test.xml:70: error: Error: Resource is not public. (at 'src' with value '@android:drawable/expander_ic_maximized').
最佳答案
您可以在您的android SDK 安装目录中找到所有android 图标。 F.ex. /opt/android-sdk-linux/platforms/android-16/data/res/drawable-hdpi/
在我的电脑上。不同的安卓版本和不同的屏幕分辨率有不同的图标集。将 expander_ic_minimized.png
文件复制到您的项目 drawable
文件夹中,图标将可用。
根据安卓开发者guide :
Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. menu icons under android.R.drawable). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system's copy changes.
关于android - 如何在 Android 中使用系统提供的图标(例如 expander_ic_maximized),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3239486/