我如何使用Android中提供的图标(如expander_ic_maximized)系统 [英] How can I use a system provided icon in Android (e.g. expander_ic_maximized)
问题描述
能否请你告诉我,我该如何使用Android的图标expander_ic_maximized? 我发现,在框架/基/核心/ RES / RES /绘制,华电国际/ expanderic_minimized.9.png
下面是我的布局xml文件:
< ImageView的机器人:ID =@ + ID /图标
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@可绘制/ expander_ic_minimized>
不过,我得到这个错误:
RES /布局/的test.xml:70:错误:错误:资源是不公开的。 (在SRC,值为@android:绘制/ expander_ic_maximized)。
您可以在您的Android SDK安装目录下所有的Android图标。 F.ex. 的/ opt / Android的SDK-Linux的/平台/ Android为16 /数据/ RES /绘制 - 华电国际/
我的电脑上。有套不同的图标不同的Android版本和不同的屏幕分辨率。复制 expander_ic_minimized.png
文件到您的项目绘制
文件夹和图标会变为可用。
据Android开发指南:
由于这些资源的平台版本之间进行转换, 使用Android平台的资源不应该引用这些图标 标识(android.R.drawable下即菜单图标)。如果你想使用的任何 图标或其他内部绘制资源,你应该存储在本地 在你的应用程序资源的图标或可绘副本,则 从应用程序code参考本地副本。这样一来,你 即使能保持对你的图标的外观控制中, 系统的副本的变化。
Can you please tell me how can I use android's icon expander_ic_maximized? I find that in frameworks/base/core/res/res/drawable-hdpi/expanderic_minimized.9.png
Here is my layout xml file:
<ImageView android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/expander_ic_minimized">
But I get this error:
res/layout/test.xml:70: error: Error: Resource is not public. (at 'src' with value '@android:drawable/expander_ic_maximized').
You can find all android icons in your android SDK installation directory. F.ex. /opt/android-sdk-linux/platforms/android-16/data/res/drawable-hdpi/
on my computer. There are different sets of icons for different android versions and for different screen resolutions. Copy expander_ic_minimized.png
files to your project drawable
folders and the icon will become available.
According to android developer 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中提供的图标(如expander_ic_maximized)系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!