【Android】2015.08.29 安卓官方文档学习:Day2 Count:2
2015-09-02 10:54
176 查看
-----------------------------------------------
Android Official Documents
Day2
Adding the action bar
-----------------------------------------------
Questions:
1. Why change the style , doesn’t work?
Because I have to chang the property :name = “AppTheme” to “MyAppTheme"
2.I feel the properties of different parent are so complex, so confusing? Especially the text Appearance
For example: If I want to change the textcolor of action bar menu text , I can use
<item name="android:actionMenuTextColor">@android:color/holo_red_dark</item>
But if I want to change the the textcolor of action bar title text, I must use:
<item name="android:actionBarStyle">@style/MyActionBar</item>
↓
<style name="MyActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/actionbar_background_blue</item>
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
</style>
↓
<style name="MyActionBarTitleText" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/holo_green_dark</item>
</style>
Why different?
3.Why paddingTop=“?android:actionBarSize” doesn’t work for display message actvity?
4. What are the differences between the methods?
// Get a string resource from your app's
String hello =
// Or supply a string resource to a method that requires a string
TextView textView = new TextView(this);
textView.setText(R.string.hello_world);
5. When an Activity inherits from parent Activity, What properties it inherits?
Points:
1. Reason for there two modes to set style:
Also notice that this theme includes two definitions for the
one with the
include the style in the platform and the one without the prefix is for older versions that read the style from the Support Library.
2.Portrait vs landscape
3. Support Multiple
languages:(IOS languages code:
http://www.w3schools.com/tags/ref_language_codes.asp)
MyProject/
res/
values/
strings.xml
values-es/
strings.xml
values-fr/
strings.xml
Screen:(By default, the
is used for portrait orientation.)
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
Bitmap:(Note: Low-density (ldpi) resources aren’t always necessary. When you provide hdpi
assets, the system scales them down by one half to properly fit ldpi screens.)
MyProject/
res/
drawable-xhdpi/ 200x200
awesomeimage.png
drawable-hdpi/ 150x150
awesomeimage.png
drawable-mdpi/ 100x100
awesomeimage.png
drawable-ldpi/ 75x75
awesomeimage.png
4. Activity !!!
Basic Lifecycle: (pyramid)
![](http://blog.csdn.net/lin_ting/article/details/cid:8b4270b5076f11b7ba183ca30f3b7149)
Static States for an extended period time:
Resumed
In this state, the activity is in the
foreground and the user can
interact with it. (Also sometimes referred to as the "running" state.)
Paused
In this state, the activity is
partially obscured by another activity—the other activity that's in the foreground is
semi-transparent or doesn't cover the entire screen. The paused activity
does not receive user input and
cannot execute any code.
Stopped
In this state, the activity is completely
hidden and not visible to the user; it is considered to be in the
background. While stopped, the activity
instance and
all its state information such as member variables is
retained, but it cannot execute any code.
The other states (Created and Started) are
transient and the system quickly moves from them to the next state by calling the next lifecycle callback method. That is, after the system calls
it quickly calls
which is quickly followed by
Terms:
Holo:整体的
Overplay Mode: 叠加模式
Android Official Documents
Day2
Adding the action bar
-----------------------------------------------
Questions:
1. Why change the style , doesn’t work?
Because I have to chang the property :name = “AppTheme” to “MyAppTheme"
2.I feel the properties of different parent are so complex, so confusing? Especially the text Appearance
For example: If I want to change the textcolor of action bar menu text , I can use
<item name="android:actionMenuTextColor">@android:color/holo_red_dark</item>
But if I want to change the the textcolor of action bar title text, I must use:
<item name="android:actionBarStyle">@style/MyActionBar</item>
↓
<style name="MyActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/actionbar_background_blue</item>
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
</style>
↓
<style name="MyActionBarTitleText" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/holo_green_dark</item>
</style>
Why different?
3.Why paddingTop=“?android:actionBarSize” doesn’t work for display message actvity?
4. What are the differences between the methods?
// Get a string resource from your app's
Resources
String hello =
getResources().getString(R.string.hello_world);
// Or supply a string resource to a method that requires a string
TextView textView = new TextView(this);
textView.setText(R.string.hello_world);
5. When an Activity inherits from parent Activity, What properties it inherits?
Points:
1. Reason for there two modes to set style:
Also notice that this theme includes two definitions for the
windowActionBarOverlaystyle:
one with the
android:prefix and one without. The one with the
android:prefix is for versions of Android that
include the style in the platform and the one without the prefix is for older versions that read the style from the Support Library.
2.Portrait vs landscape
3. Support Multiple
languages:(IOS languages code:
http://www.w3schools.com/tags/ref_language_codes.asp)
MyProject/
res/
values/
strings.xml
values-es/
strings.xml
values-fr/
strings.xml
Screen:(By default, the
layout/main.xmlfile
is used for portrait orientation.)
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
Bitmap:(Note: Low-density (ldpi) resources aren’t always necessary. When you provide hdpi
assets, the system scales them down by one half to properly fit ldpi screens.)
MyProject/
res/
drawable-xhdpi/ 200x200
awesomeimage.png
drawable-hdpi/ 150x150
awesomeimage.png
drawable-mdpi/ 100x100
awesomeimage.png
drawable-ldpi/ 75x75
awesomeimage.png
4. Activity !!!
Basic Lifecycle: (pyramid)
Static States for an extended period time:
Resumed
In this state, the activity is in the
foreground and the user can
interact with it. (Also sometimes referred to as the "running" state.)
Paused
In this state, the activity is
partially obscured by another activity—the other activity that's in the foreground is
semi-transparent or doesn't cover the entire screen. The paused activity
does not receive user input and
cannot execute any code.
Stopped
In this state, the activity is completely
hidden and not visible to the user; it is considered to be in the
background. While stopped, the activity
instance and
all its state information such as member variables is
retained, but it cannot execute any code.
The other states (Created and Started) are
transient and the system quickly moves from them to the next state by calling the next lifecycle callback method. That is, after the system calls
onCreate(),
it quickly calls
onStart(),
which is quickly followed by
onResume().
Terms:
Holo:整体的
Overplay Mode: 叠加模式
相关文章推荐
- Android主题和样式之系统篇
- 【Android】2015.08.28 安卓官方文档学习:Day1 Count:1
- Android ListView中使用CheckBox等的混乱问题
- android自动化框架对比
- AndroidStudio 生成签名的APK
- Windows环境下Android Studio v1.0安装教程
- Android自定义圆形图片
- Android 上传文件,图片。以及服务器端接收相关。
- 【Android】Android初步学习路线
- Android 应用有哪些常见,常被利用的安全漏洞?
- android studio 将一个android项目当做另外一个android项目的library
- 最完美的android仿ios开关按钮源码
- android 如何加入第一3正方形lib图书馆kernel于
- android源码出现的@字符代表什么意思
- 强大Android图片加载的框架:Fresco
- Android搜索芽发展clientVersion1.0结束(过程和结果显示)
- Android NDK开发学习(一)
- android viewpager 一页显示多个图片
- Android笔记(十五)Handler初步
- android 学习 数据存储