Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.
For example, a sample Android app that contains a user interface layout (main.axml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:
Resources/
drawable/
icon.png
layout/
main.axml
values/
strings.xml
In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called "R"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the R class would expose:
public class R {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
to reference the layout/main.axml file, or R.strings.first_string to reference the first
string in the dictionary file values/strings.xml.

dotnet全栈开发
- 粉丝: 2w+
最新资源
- 低延迟通信:DelphiQUIC协议替代TCP在视频传输中的实践.pdf
- 低代码开发革命:Delphi可视化DSL设计器动态生成业务逻辑.pdf
- 低代码开发革命:Delphi可视化搭建企业CRUD系统实战.pdf
- 颠覆性性能突破:DelphiFireMonkey框架Metal、Vulkan后端渲染优化全解析.pdf
- 颠覆传统界面设计:FireMonkey动画引擎实现3D交互式仪表盘.pdf
- 第三方框架对决:uniGUI与TMSWEBCore在DelphiWeb应用中的性能对比.pdf
- 调试技巧进阶:DelphiCPU视图与符号调试实战案例.pdf
- 调试技巧终极手册:DelphiCPU视图与事件日志联调.pdf
- 动态表单生成:RTTI在动态UI绑定中的创新应用.pdf
- 动态表单生成革命:DelphiRTTI反射实现元数据驱动界面架构.pdf
- 动态表单生成艺术:DelphiRTTI运行时类型信息高级应用.pdf
- 动态数据绑定:LiveBindings关联数据库的秘诀.pdf
- c# Winform 根据word模板生成word.rar
- 动态资源加载:插件式架构动态挂载DLL模块实战.pdf
- 动态资源加载:Delphi多语言热切换与资源隔离方案.pdf
- 动态资源加载进阶:Delphi多语言切换的无重启解决方案.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


