您的位置:首页 > 移动开发 > Android开发

【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
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
windowActionBarOverlay
style:
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.xml
file
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: 叠加模式
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: