android development introduction chương 16 android external resources

22 387 0
android development introduction chương 16 android external resources

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

  16    !"#  $%&''()&''*+,""# */()')*(01/(')')* 2  344##4# & 01#5  & Resources and Internaonalizaon 67,)6899# :;!:6,$< ",=,>=6# ?:,< "6,:$::@#.$, !A,@$:# 344##4$444)0(# B 01#5  B Using Resources !!:non-code assets A9# CResources9DA9$ :$Context.getResources()# ,source tree 9# E 01#5  E Copy/Paste Resources CA6 res/F#  Resources are compiled into the nal APK le. A,R, :# $6:6 G 01#5  G 1 01#5  1 9:>9 $$#!6 / 01#5  / Examples# : : c:\Android\pla"orms\android-1.5\data\res\ ( 01#5  ( More Examples# ApiDemos9# :#H: c:\Android\pla"orms\android-1.6\samples\  How to install the App: H)IA)I=F)IAndroid=F)I .JCreate project form exisng sourceJ .ApiDemos :7$6A:F8 * 01#5  * Java Statements for Using Resources $ setContentView(R.layout.main); setContentView(R.layout.screen2); 0' 01#5  0' Java Statements for Using Resources $String:44K String msg = this.getString(R.string.color_prompt); <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Hola Mundo!, ResourceDemo1!</string> <string name="app_name">ResourceDemo1</string> <string name="good_bye">Hasta luego</string> <string name="color_caption">Color:</string> <string name="color_prompt">Seleccione un Color</string> <string name="planet_caption"> <b>Planeta </b>Planeta <i>Planeta </i><u>Planeta: </u></string> <string name="planet_prompt">Seleccione un Planeta</string> </resources> /res/values/strings.xml [...]... ArrayAdapter.createFromResource( this, R.array.planets, android. R.layout.simple_spinner_item); adapter.setDropDownViewResource( android. R.layout.simple_spinner_dropdown_item); s2.setAdapter(adapter); } } 17 16 Android – Resources Android Resources mmmm 18 16 Android – Resources Android Resources mmmm 19 16 Android – Resources Android Resources mmmm 20 21 16 Android – Resources Resources Questions ? 22 ... Resources Android Resources Example1 Using Embedded Resources (drawable, string, array) 15 16 Android – Resources Android Resources Example1 Using Embedded Resources (drawable, string, array) // using Resources (adapted from Android - ApiDemos) package cis493 .resources; import android. app.Activity; import android. os.Bundle; import android. widget.ArrayAdapter; import android. widget.EditText; import android. widget.ImageView;... imageView1.setImageResource( R.drawable .android_ green_3d); 13 16 Android – Resources Android Resources Example1 Using Embedded Resources (drawable, string, array) #7f00 #770000ff As in HTML a string using , , modifiers will be rendered in: bold, italics, and, underlined modes In our example: Planeta Planeta Planeta Planeta 11 16 Android – Resources Android Resources Java Statements for Using Resources Retrieving Array Resources from: res/values/… /res/values/arrays.xml . xmlns :android= "http://schemas .android. com/apk/res /android& quot; android: orientation="vertical" android: padding="10dip" android: layout_width="fill_parent" android: layout_height="fill_parent" . M$7A,$,8# // using Resources (adapted from Android - ApiDemos) package cis493 .resources; import android. app.Activity; import android. os.Bundle; import android. widget.ArrayAdapter; import android. widget.EditText; import. <Spinner android: id="@+id/spinner2" android: layout_width="fill_parent" android: layout_height="wrap_content" android: drawSelectorOnTop="true" android: prompt="@string/planet_prompt"

Ngày đăng: 23/10/2014, 08:56

Từ khóa liên quan

Mục lục

  • Slide 1

  • Slide 2

  • Slide 3

  • Slide 4

  • Slide 5

  • Slide 6

  • Slide 7

  • Slide 8

  • Slide 9

  • Slide 10

  • Slide 11

  • Slide 12

  • Slide 13

  • Slide 14

  • Slide 15

  • Slide 16

  • Slide 17

  • Slide 18

  • Slide 19

  • Slide 20

Tài liệu cùng người dùng

Tài liệu liên quan