- 浏览: 582429 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (338)
- 已过时文章(留念用) (39)
- Android学习笔记 (30)
- Android开发指引自译 (100)
- Android NDK文档自译 (23)
- Android设计指引自译 (2)
- xp(ペケピー)&linux(理奈、铃)酱~ (4)
- ui酱&歌词自译~ (9)
- lua酱~ (9)
- 自我反省 (1)
- 羽game计划 (1)
- XSL酱 (2)
- java酱 (3)
- 设计的领悟 (58)
- 涂鸦作品(pixiv) (1)
- ruby酱 (2)
- Objective-C编程语言自译 (2)
- Android开发月报 (6)
- objc酱 (2)
- photoshop (3)
- js酱 (6)
- cpp酱 (8)
- antlr酱 (7)
- Lua 5.1参考手册自译 (11)
- 收藏品 (3)
- 待宵草计划 (4)
- 体验版截图 (1)
最新评论
-
naruto60:
太给力了!!!!我这网打不开Intel官网,多亏楼主贴了连接, ...
使用HAXM加速的Android x86模拟器(和一些问题) -
yangyile2011:
谢谢博主,翻译得很好哦
【翻译】(4)片段 -
ggwang:
牙痛的彼岸:痹!
牙痛的彼岸 -
ggwang:
总结得很简练清晰啊,学习了!
ANTLR学习笔记一:概念理解 -
leisurelife1990:
mk sdd
用git下载Android自带app的源代码
【翻译】(27)应用程序资源
see
http://developer.android.com/guide/topics/resources/index.html
原文见
http://developer.android.com/guide/topics/resources/index.html
-------------------------------
Application Resources
应用程序资源
Topics
主题
* Providing Resources 提供资源
* Accessing Resources 访问资源
* Handling Runtime Changes 处理运行时改变
* Localization 本地化
Reference
参考
Resource Types 资源类型
You should always externalize resources such as images and strings from your application code, so that you can maintain them independently. Externalizing your resources also allows you to provide alternative resources that support specific device configurations such as different languages or screen sizes, which becomes increasingly important as more Android-powered devices become available with different configurations. In order to provide compatibility with different configurations, you must organize resources in your project's res/ directory, using various sub-directories that group resources by type and configuration.
你应该总是从你的应用程序中外部化资源诸如图片和字符串,使你可以独立地维护它们。外部化你的资源还允许你提供支持特定设备配置的可选资源诸如不同的语言或屏幕大小,这随着带有不同配置的更多基于Android的设备变得可用而变得日益重要。为了提供不同配置的兼容性,你必须在你的工程的res/目录下组织资源,使用不同的子目录根据类型和配置分组资源。
(图1略:
Android设备A
Android应用 默认资源
Android设备B
)
Figure 1. Two different devices, both using default resources.
图1. 两个不同的设备,都使用默认资源。
(图2略:
Android设备A
Android应用 默认资源 可选资源B
Android设备B
)
Figure 2. Two different devices, one using alternative resources.
图2. 两个不同的设备,其中有一个使用候选资源。
For any type of resource, you can specify default and multiple alternative resources for your application:
对于任意类型的资源,你可以为你的应用程序指定默认的和多个候选的资源:
* Default resources are those that should be used regardless of the device configuration or when there are no alternative resources that match the current configuration.
* 默认资源是那些应该在无需考虑设备配置或者在没有候选的资源匹配当前配置的时候使用的资源。
* Alternative resources are those that you've designed for use with a specific configuration. To specify that a group of resources are for a specific configuration, append an appropriate configuration qualifier to the directory name.
* 候选资源是那些你已经设计好用于特定配置的资源。为了指定一组资源用于一个特定的配置,请尾加一个合适的配置修饰符到目录名。
For example, while your default UI layout is saved in the res/layout/ directory, you might specify a different UI layout to be used when the screen is in landscape orientation, by saving it in the res/layout-land/ directory. Android automatically applies the appropriate resources by matching the device's current configuration to your resource directory names.
例如,当你的默认用户界面布局保存在res/layout/目录,你可以指定一个不同的用户界面布局在屏幕处于宽屏方向时使用,通过保存它在res/layout-land/目录下。Android通过匹配设备的当前配置到你的资源目录名,自动地应用合适的资源。
Figure 1 demonstrates how a collection of default resources from an application are applied to two different devices when there are no alternative resources available. Figure 2 shows the same application with a set of alternative resources that qualify for one of the device configurations, thus, the two devices uses different resources.
图1演示当没有可用的可选资源时,来自一个应用程序的一组默认资源如何被应用到两个不同的设备。图2展示带有一组分别修饰一种设备配置的可选资源的相同应用程序,这种情况下,两个设备使用不同的资源。
The information above is just an introduction to how application resources work on Android. The following documents provide a complete guide to how you can organize your application resources, specify alternative resources, access them in your application, and more:
上面的信息只是介绍应用程序资源是如何工作在Android上。以下文档提供一个完整的指引,关于你如何可以组织你的应用程序资源,指定候选资源,在你的应用程序中访问它们,以及更多:
* Providing Resources
* 提供资源
What kinds of resources you can provide in your app, where to save them, and how to create alternative resources for specific device configurations.
你可以在你的应用中提供哪些类型的资源,在哪里保存它们,以及如何为特定的设备配置创建候选资源。
* Accessing Resources
* 访问资源
How to use the resources you've provided, either by referencing them from your application code or from other XML resources.
如何使用你已经提供的资源,通过从你的应用程序代码中或者从其它XML资源中引用它们来做到。
* Handling Runtime Changes
* 处理运行时改变
How to manage configuration changes that occur while your Activity is running.
如何管理在你的Activity正在运行时发生的配置改变。
* Localization
* 本地化
A bottom-up guide to localizing your application using alternative resources. While this is just one specific use of alternative resources, it is very important in order to reach more users.
一个关于使用可选资源本地化你的应用程序的自下而上的指引。虽然这只是可选资源的一个特定用途,然而这对于接触更多用户来说非常重要。
* Resource Types
* 资源类型
A reference of various resource types you can provide, describing their XML elements, attributes, and syntax. For example, this reference shows you how to create a resource for application menus, drawables, animations, and more.
你可以提供的不同资源类型的参考文档,描述它们的XML元素、属性,以及语法。例如,这个参考文档向你展示如何为应用程序的菜单、可绘画对象、动画,以及更多东西创建一个资源。
Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License.
除特别说明外,本文在Apache 2.0下许可。细节和限制请参考内容许可证。
Android 4.0 r1 - 21 Dec 2011 3:15
-------------------------------
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
(此页部分内容基于Android开源项目,以及使用根据创作公共2.5来源许可证描述的条款进行修改)
(本人翻译质量欠佳,请以官方最新内容为准,或者参考其它翻译版本:
* ソフトウェア技術ドキュメントを勝手に翻訳
http://www.techdoctranslator.com/android
* Ley's Blog
http://leybreeze.com/blog/
* 农民伯伯
http://www.cnblogs.com/over140/
* Android中文翻译组
http://androidbox.sinaapp.com/
)
发表评论
-
【翻译】(9-补丁2)电话簿提供者
2012-07-18 12:54 2404【翻译】(9-补丁2)电话簿提供者 see h ... -
【翻译】(8-补丁1)Android接口定义语言(AIDL)
2012-07-02 05:55 2941【翻译】(8-补丁1)Andro ... -
【翻译】(0)应用组件
2012-06-30 23:50 833【翻译】(0)应用组件 see http:// ... -
【翻译】(88)传感器
2012-05-21 21:25 1082【翻译】(88)传感器 ... -
【翻译】(87)复制与粘贴
2012-05-20 14:48 1943【翻译】(87)复制与粘贴 see http: ... -
【翻译】(86)音频捕捉
2012-05-16 15:14 1107【翻译】(86)音频捕捉 ... -
【翻译】(85)照相机
2012-05-13 15:09 3807【翻译】(85)照相机 see http:// ... -
【翻译】(84)JetPlayer
2012-04-21 16:24 992【翻译】(84)JetPlayer see h ... -
【翻译】(83)媒体回放
2012-04-21 16:00 1867【翻译】(83)媒体回放 see http:/ ... -
【翻译】(82)多媒体与照相机
2012-04-18 23:05 960【翻译】(82)多媒体与照相机 see htt ... -
【翻译】(23-补丁3)构建无障碍服务
2012-04-18 21:57 1633【翻译】(23-补丁3)构 ... -
【翻译】(23-补丁2)使应用程序无障碍
2012-04-16 13:08 2104【翻译】(23-补丁2)使应用程序无障碍 see ... -
【翻译】(23-补丁1)无障碍
2012-04-11 22:38 918【翻译】(23-补丁1)无 ... -
【翻译】(81)Renderscript之运行时API参考手册
2012-04-11 22:13 1419【翻译】(81)Renderscript之运行时API参 ... -
【翻译】(80)Renderscript之计算
2012-04-09 14:09 1450【翻译】(80)Renderscript之计算 ... -
【翻译】(79)Renderscript之图形
2012-04-08 13:59 2877【翻译】(79)Renderscript之图形 ... -
【翻译】(78)Renderscript
2012-04-04 15:35 1450【翻译】(78)Renderscript see ... -
【翻译】(77)可绘画对象动画
2012-03-18 10:52 717【翻译】(77)可绘画对象动画 see htt ... -
【翻译】(76)视图动画
2012-03-18 10:04 812【翻译】(76)视图动画 see http:/ ... -
【翻译】(75)属性动画
2012-03-17 18:24 2512【翻译】(75)属性动画 see http:/ ...
相关推荐
本主题将深入探讨QML应用程序的开发,特别是其中的中英文翻译问题。 在QML编程中,我们通常会遇到需要对UI元素进行多语言支持的情况。Qt提供了i18n(internationalization,国际化)功能,帮助开发者实现应用的多...
5. **国际化支持:** 如果应用程序支持多语言环境,确保相应的翻译文件已经就绪,并且能够随着应用程序一起发布。 #### 二、应用程序的发布流程 1. **Release模式编译:** 使用Release模式编译应用程序,以确保...
JSP最终会被翻译成Servlet,而Servlet是Java Web应用程序的核心。JSP提供了一个更面向视图的模型,使得界面设计和业务逻辑分离。 **8. MVC设计模式** 在开发JSP应用程序时,通常会采用MVC(Model-View-Controller)...
2. **构建工具**:`aapt`(Android Asset Packaging Tool)是Android SDK提供的一个工具,用于将编译后的Java代码与应用程序所需的其他数据和资源文件打包成一个`.apk`文件。`.apk`文件是应用程序在移动设备上安装和...
本文档——“安卓应用程序基础-外文翻译.pdf”——将深入讲解安卓应用的基本概念和技术。 首先,安卓应用程序是通过Android SDK工具进行编译的。开发者所写的源代码、数据以及资源文件会被打包成一个Android包(APK...
Win32最基础应用程序是指基于Microsoft Windows操作系统的32位应用程序开发。Win32 API(应用程序接口)是Windows操作系统提供给开发者的一个接口,允许程序员直接与操作系统交互,创建各种功能丰富的桌面应用程序。...
【标题】"java翻译程序含源码"指出这是一个基于...对于学习者来说,这个项目不仅能够帮助他们理解如何使用Java进行API调用,还能了解到如何构建一个实用的翻译应用,包括界面设计、用户输入处理以及结果展示等环节。
本文将详细介绍一个专为macOS设计的简单编辑器应用程序,该程序专注于帮助用户管理iOS和macOS应用的本地化过程,特别强调了并排编辑多语言翻译的功能。 首先,我们要理解什么是应用程序的本地化。本地化不仅仅是...
通过合理使用这些字符串资源,开发者可以提高代码的可读性,简化翻译过程,并方便地调整应用程序的文本内容。这在多语言支持和动态内容展示方面尤其重要。同时,通过资源管理,Android系统也能更高效地处理内存,...
《使用微服务Spring Boot的公共投诉系统后端应用程序的设计与开发》 在现代软件工程领域,微服务架构已经成为构建可扩展、高可用性系统的重要手段。Spring Boot作为Java生态系统中的明星框架,以其简洁的配置、快速...
这可能是因为移动应用程序提供了额外的学习资源和工具,有助于巩固课堂上学到的知识,还可能是因为它们增加了学习的趣味性,从而提高了学生的积极性。移动应用程序还可以提供即时反馈和评估,这对于学生的自我提升和...
"swift-简单的macOS编辑器应用程序能并排编辑所有翻译管理iOS应用程序本地化"是一个专为iOS应用本地化设计的工具,旨在简化多语言版本的编辑过程。这个项目基于Swift编写,提供了一个在macOS上运行的简洁界面,允许...
《studyEnglish在线学习小程序:构建实时翻译功能的实践与解析》 在当今信息化时代,学习英语的方式变得越来越多样化,而在线学习小程序凭借其便捷性、互动性和即时性,已经成为许多学习者的选择。本文将深入探讨一...
标题"RFC1823 LDAP应用程序接口中文版"表明这是一个关于轻量级目录访问协议(Lightweight Directory Access Protocol, LDAP)的应用程序接口(Application Programming Interface, API)的中文文档。RFC1823是互联网...
Android应用程序主要使用Java语言编写,编译后的Java代码与系统所需的数据和资源文件通过AAPT(Android Asset Packaging Tool)工具打包成一个Android包,即APK文件。APK文件是Android应用的分发和安装格式,用户...
PDF翻译软件前端程序是用于帮助用户将PDF文档内容翻译成其他语言的应用程序。在这款软件中,前端部分主要负责用户界面交互和与后端服务的通信。为了实现这个功能,开发者通常需要集成第三方API,例如百度提供的翻译...