2013.05.022013.05.02Android apps development IAndroid apps development I- How to build your first app.- How to build your ...
2013.05.022013.05.02ContentContent UI & Environment Intro.UI & Environment Intro. Say Hello World!Say Hello World! Layo...
2013.05.022013.05.02 srcsrc•javajava 原始碼原始碼 res (resource)res (resource)•iconsicons•layoutlayout•string...etc.string...e...
2013.05.022013.05.02LayoutLayoutLets see RAW content (.xml)Lets see RAW content (.xml)
2013.05.022013.05.02Layout – res / layout / main.xmlLayout – res / layout / main.xml
2013.05.022013.05.02Layout StructureLayout Structure ViewGroupViewGroup●A layout or container such asA layout or containe...
2013.05.022013.05.02<TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/...
2013.05.022013.05.02Layout – res / values / strings.xmlLayout – res / values / strings.xmlfor i18n purpose<?xml version="1...
2013.05.022013.05.02Add behaviorAdd behaviorScenerio:畫面上有一顆按鈕,當按下按鈕後,在其下方出現預藏的文字。
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)1. Add a button2. Hide the text3. Make the button show text
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)1. Add a button1. Add a button1-1. 利用滑鼠 曳新增一按鈕拖1-2. 設定按鈕上的提示文字
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)2. Hide the text2. Hide the textandroid:visibility="invisible"...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)2. Hide the text2. Hide the text Go toGo to android developer...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)Invisible你看不到我,你看不到我但是 ... 仍然佔據空間
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show text3-1. a...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show text3-1. a...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show text<Butto...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textMain.j...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textBridge...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textfindVi...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textR.id.t...
2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textMain.j...
2013.05.022013.05.02Again, how do I knowwhat method I can use?Add behavior (cont.)Add behavior (cont.)
2013.05.022013.05.02 Go toGo to android developer siteandroid developer site•ReferenceReference•android.wigetandroid.wige...
2013.05.022013.05.02Thanks!
Upcoming SlideShare
Loading in...5
×

2013.05.02 android-l1

101

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
101
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2013.05.02 android-l1

  1. 1. 2013.05.022013.05.02Android apps development IAndroid apps development I- How to build your first app.- How to build your first app.Introduction ofIntroduction of
  2. 2. 2013.05.022013.05.02ContentContent UI & Environment Intro.UI & Environment Intro. Say Hello World!Say Hello World! Layout Intro.Layout Intro. Add the behaviorAdd the behavior
  3. 3. 2013.05.022013.05.02 srcsrc•javajava 原始碼原始碼 res (resource)res (resource)•iconsicons•layoutlayout•string...etc.string...etc. libslibs 靜態函式庫靜態函式庫Package ExplorerPackage Explorer
  4. 4. 2013.05.022013.05.02LayoutLayoutLets see RAW content (.xml)Lets see RAW content (.xml)
  5. 5. 2013.05.022013.05.02Layout – res / layout / main.xmlLayout – res / layout / main.xml
  6. 6. 2013.05.022013.05.02Layout StructureLayout Structure ViewGroupViewGroup●A layout or container such asA layout or container such as RelativeLayoutRelativeLayoutoror LinearLayoutLinearLayout ViewView●A child of ViewGroup such asA child of ViewGroup such as buttonbutton oror texttextfieldfield
  7. 7. 2013.05.022013.05.02<TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" />Layout – View (TextView)Layout – View (TextView)@ 代表一個 pointer ,指向真正的字串內容
  8. 8. 2013.05.022013.05.02Layout – res / values / strings.xmlLayout – res / values / strings.xmlfor i18n purpose<?xml version="1.0" encoding="utf-8"?><resources><string name="app_name">Hello World</string><string name="action_settings">Settings</string><string name="hello_world">Hello world!</string></resources>
  9. 9. 2013.05.022013.05.02Add behaviorAdd behaviorScenerio:畫面上有一顆按鈕,當按下按鈕後,在其下方出現預藏的文字。
  10. 10. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)1. Add a button2. Hide the text3. Make the button show text
  11. 11. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)1. Add a button1. Add a button1-1. 利用滑鼠 曳新增一按鈕拖1-2. 設定按鈕上的提示文字
  12. 12. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)2. Hide the text2. Hide the textandroid:visibility="invisible" Just add the attribution to TextViewJust add the attribution to TextViewBut how do I know whatattribution I can use?
  13. 13. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)2. Hide the text2. Hide the text Go toGo to android developer siteandroid developer site•ReferenceReference•android.wigetandroid.wiget•TextViewTextView•Inherited XML AttributesInherited XML Attributes•Attribute NameAttribute Name•android:visibilityandroid:visibility
  14. 14. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)Invisible你看不到我,你看不到我但是 ... 仍然佔據空間
  15. 15. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show text3-1. add the attribution to button3-1. add the attribution to buttonandroid:onClick="android:onClick="showTextshowText""3-2. write the code of3-2. write the code of showTextshowTextmethodmethod
  16. 16. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show text3-1. add the attribution to button3-1. add the attribution to buttonandroid:onClick="android:onClick="showTextshowText""3-2. write the code of3-2. write the code of showTextshowTextmethodmethod
  17. 17. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show text<Buttonandroid:id="@+id/button1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/btn_click_text"android:onClick="showText" />main.xml
  18. 18. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textMain.javapublic void showText (View view) {// - 宣告元件// - 操作元件}
  19. 19. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textBridge to XML & JAVA.xml .javaR.* 資源檔findViewById
  20. 20. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textfindViewById example// 在 Main.java 中宣告 UI 中的 button1Button button = (Button) findViewById (R.id.button1);// 在 Main.java 中宣告 UI 中的 TextViewTextView textView = (TextView) findViewById (R.id.tv1);Main.java
  21. 21. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textR.id.tv1 ?什麼東西?好像沒看過?TextView 預設沒給定操作 id ,加上它吧!main.xml<TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/button1"android:id="@+id/tv1"android:text="@string/hello_world"android:visibility="invisible" />
  22. 22. 2013.05.022013.05.02Add behavior (cont.)Add behavior (cont.)3. Make the button show text3. Make the button show textMain.javapublic void showText(View view) {Button button = (Button) findViewById(R.id.button1);TextView tv1 = (TextView) findViewById(R.id.tv1);tv1.setVisibility(View.VISIBLE);}
  23. 23. 2013.05.022013.05.02Again, how do I knowwhat method I can use?Add behavior (cont.)Add behavior (cont.)
  24. 24. 2013.05.022013.05.02 Go toGo to android developer siteandroid developer site•ReferenceReference•android.wigetandroid.wiget•TextViewTextView•Inherited XML AttributesInherited XML Attributes•Related MethodRelated Method•setVisibility(int)setVisibility(int)Add behavior (cont.)Add behavior (cont.)
  25. 25. 2013.05.022013.05.02Thanks!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×