Android学习记录三(Supporting Different Devices)
2013-04-07 14:46
441 查看
一、支持不同的语言。
Project
res/
values/ strings.xml
values-es/ strings.xml 支持Locale为es的
values-fr/ strings.xml 支持Locale为fr的
这种支持不同语言的方式可以用在任何的资源上。
二、支持不同的屏幕。
1、android一般通过2个属性来分辨系统的屏幕,大小和分辨率。一般类说有四种大小(small, normal, large, xlarge),
四种分辨率(low (ldpi), medium (mdpi), high (hdpi), extra high (xhdpi)),注意屏幕的方向也是大小的一种变化。
land表示android系统横屏时的布局。
2、对于图片来说主要是根据分辨率来获取相应的图片资源,分辨率分为四种:
small:75×75
normal: 100×100
large:150×150
xlarge:200×200
三、支持不同的android版本。
1、在AndroidManifest.xml 指定支持的最低版本和最高版本:
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="15"
/>
2、在运行时验证当前android的版本:
if
(Build.VERSION.SDK_INT
>= Build.VERSION_CODES.HONEYCOMB)
{
ActionBar actionBar
= getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
在android解析xml文件时,会忽略那些当前版本不支持的xml元素。
3、指定主题(theme),样式(style):
style是应用于元素的,theme是应用于窗体的。如果要应用程序的所有窗体都使用一个theme,则可以
<application
android:theme="@style/CustomTheme">
Project
res/
values/ strings.xml
values-es/ strings.xml 支持Locale为es的
values-fr/ strings.xml 支持Locale为fr的
这种支持不同语言的方式可以用在任何的资源上。
二、支持不同的屏幕。
1、android一般通过2个属性来分辨系统的屏幕,大小和分辨率。一般类说有四种大小(small, normal, large, xlarge),
四种分辨率(low (ldpi), medium (mdpi), high (hdpi), extra high (xhdpi)),注意屏幕的方向也是大小的一种变化。
land表示android系统横屏时的布局。
2、对于图片来说主要是根据分辨率来获取相应的图片资源,分辨率分为四种:
small:75×75
normal: 100×100
large:150×150
xlarge:200×200
三、支持不同的android版本。
1、在AndroidManifest.xml 指定支持的最低版本和最高版本:
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="15"
/>
2、在运行时验证当前android的版本:
if
(Build.VERSION.SDK_INT
>= Build.VERSION_CODES.HONEYCOMB)
{
ActionBar actionBar
= getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
在android解析xml文件时,会忽略那些当前版本不支持的xml元素。
3、指定主题(theme),样式(style):
style是应用于元素的,theme是应用于窗体的。如果要应用程序的所有窗体都使用一个theme,则可以
<application
android:theme="@style/CustomTheme">
相关文章推荐
- AndroidTraining学习------Support-Different-Devices
- Android Develop Training——Android应用支持多设备(Supporting Different Devices)
- 阅读Android官方教程 Google Training 1.2 ------ Supporting Different Devices
- android-Supporting Different Devices
- Android Framework学习笔记 -- 移植cm的记录
- Android学习记录<五>
- Android学习记录(四) 只在当前应用有效的数据库实现。
- AR 学习记录 unity+vuforia+ android 初次搭建
- android action bar 学习记录
- 学习记录: android 源码的下载_探究(一)
- Android学习记录四(应用程序基本知识)
- 记录几个android学习网站
- android学习问题记录(Missing content Description attribute on image)
- 记录Android异步加载的学习(线程池、信号量、图片压缩、Looper)
- Android doc |Getting Started|部分 部分译文 --Supporting Different Devices
- Android Zygote(zaɪɡoʊt)启动流程学习笔记记录
- Android学习记录(5)—在java中学习多线程下载之断点续传②
- Android学习记录(二十六)-Android toolbar使用遇到的坑。
- Android学习记录帖
- Android基础知识学习记录