lesson 2 Supporting Different Devices
来源:互联网 发布:最新版软件开发合同 编辑:程序博客网 时间:2024/06/09 13:47
Supporting Different Devices
1 Supporting Different Languages支持不同的语言
To add support for more languages, create additional values directories inside res/ that include a hyphen and the ISO language code at the end of the directory name. For example, values-es/ is the directory containing simple resourcess for the Locales with the language code “es”. Android loads the appropriate resources according to the locale settings of the device at run time. For more information, see Providing Alternative
For example MyProject/res/ values/ strings.xml values-es/ strings.xml values-fr/ strings.xml
2 Supporting Different Screens支持不同的屏幕
Android categorizes device screens using two general properties: size and density
2.1 There are four generalized sizes: small, normal, large, xlarge
Each layout should be saved into the appropriate resources directory, named with a -<screen_size>
suffix
MyProject/res/ layout/ # default (portrait) main.xml layout-land/ # landscape main.xml layout-large/ # large (portrait) main.xml layout-large-land/ # large landscape main.xml
Note: Android 3.2 and above supports an advanced method of defining screen sizes that allows you to specify resources for screen sizes based on the minimum width and height in terms of density-independent pixels. This lesson does not cover this new technique. For more information, read Designing for Multiple Screens.
2.2 And four generalized densities: low (ldpi), medium (mdpi), high (hdpi), extra high (xhdpi)
- xhdpi: 2.0
- hdpi: 1.5
- mdpi: 1.0 (baseline)
- ldpi: 0.75
MyProject/res/ drawable-xhdpi/ awesomeimage.png drawable-hdpi/ awesomeimage.png drawable-mdpi/ awesomeimage.png drawable-ldpi/ awesomeimage.png
3 Supporting Different Platform Versions支持不同的android版本
3.1 Specify Minimum and Target API Levels
3.2 Check System Version at Runtime
private void setUpActionBar() {// Make sure we're running on Honeycomb or higher to use ActionBar APIs if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); }}
- 3.3 Use Platform Styles and Themes
- lesson 2 Supporting Different Devices
- android-Supporting Different Devices
- Supporting Different Devices笔记
- Supporting Different Devices - Supporting Different Screens
- Supporting Different Devices - Supporting Different Platform Versions
- Supporting Different devices - Supporting Different Languages
- Android学习记录三(Supporting Different Devices)
- Android官方文档翻译 十二 3.Supporting Different Devices
- 阅读Android官方教程 Google Training 1.2 ------ Supporting Different Devices
- Android doc |Getting Started|部分 部分译文 --Supporting Different Devices
- (二)Supporting Different Devices支持不同的设备
- Android Develop Training——Android应用支持多设备(Supporting Different Devices)
- (3)Supporting different device
- Supporting Different Screens
- Supporting Different Screens
- Supporting Different Screens
- dp-Supporting Different Screens
- Supporting Different Screen Sizes
- [笔记]面向对象的程序设计
- 【Code】Js-mind插件中会使用到的一个递归拼装数据格式的函数
- 单例模式讲解
- 解决ios证书无效问题
- Android消息机制------Handler机制的原理(超详细)
- lesson 2 Supporting Different Devices
- 【转】分布式异步任务队列 Celery + rabbitmq (or redis )
- HTML使用列表
- Js中的call和apply
- java线程基础
- 封装RecyclerViewAdapter实现RecyclerView下拉刷新上拉加载更多
- Java四种线程池的使用
- ORM框架分析之DB到Entity的映射(二)
- LeetCode318:Maximum Product Of Word Length