Info

r spinner mtwjttiu //a^ntiiWA/iiw^^fAM'ii-^,

7.3.8 ( AutoCompleteTextView )

r klfll/H/ilft Spinner Android ilHitt i' • tt * if # OH £ IW ft M ffl 41A ft s\

AutoCompleteTextView, #'RtttiffiVXtSi f \H

main.xml 3C#±Msin—tifif AutoComplete lext View Activity XML XftiWiM h"J?i/J<:

<But tors Android: id="0+id/autp_complete button"

Android:layout width="wrap_content" Android:layout heightr"wrap content" Android:Lext="AutoCompleteTextView" />

5ii SL id %} " autocompletebutton " fftfr'M. # ftJtMX"f Sl" AutoCompleteTextView

«JftftAftl private But.ton.OnClickListener auto_comp!ete button_listener = new Button.OnCiickListener () | public void oriClick(View v) { Intent intent = new Intent();

j rstenL.setCiass(MainActivity.this, AutoCompleteTextVi ewActivity.class); startActivity(intent) ; ) );

ill I IAutoCompleteText ViewActi vity o

, ri/ fi-fi'Jiii AutoCompleteTextViewActivity.java $Cft* Jl'-fiiii autocomplete.xml.

/I: autocomplete.xml ifl^l'^/JII AutoCompleteTextView Sift, ^SMW-JiWTSf^s

<AutoComp1eteTextView Android:id="6 + id/auto comp1ete" Android:layout widt;h="f ill_parent" Android:layout height-"wrapcontent"/>

'ALX id 44auto complete" M AutoCompleteTextView

PliiS^o

^lu/i: AutoCompleteText ViewActivity.java lit ft" < t' 5t tic W, % ft I:. -

gLffiSSt^ftfttt:

static final String[] COUNTRIES = new String(] I "China" ,"Russia", "Germany",

"Ukraine", "Belarus", "USA" ,"Chinal" ,"Chinal2", "Germany", "Russia2", "Belarus", "USA"

protected void onCreate(Bundle savedlnstanceState) { super.onCreate(savedlnstanceState); set Cor. tent View (R. layout. autocomplete) ; setTitle("AutoCompleteTextViewActivity");

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,

Android.R.layout.simple_dropdown_item_lline, COUNTRIES); AutoCompleteTextView textView = (AutoCompleteTextView) f irtdViewByld (R. ici-aut: > complete);

textView. set.Adapter (adapter) ;

% 7 M Jf5S-Android a&fliSfllftiftiPWaii, HMMMXtti COUNTRIES fi'Ja ArrayAdapter, AutoCompleteTextView l.o

Kjn-A: AndroidManifest.xml Jtft + SJsiH Activity fi<J^Hf

<activity

Android: name="AutoCompleteTextViewAc:tivi ty"x/acti vit.y>

¡¿'<pm. /ii+^ifii t'T'-.fr "AutoComplctcTextView " ft'ffl. tT)f AutoCompleteTextViewActivity Wffffl, +»A"chM, ill 1*1 7-23

AutoCompleteTextView (ft fj ^tfK&fiBffii&HJIS«

Android SDK 7.3.9 ( DatePicker )

DatePicker fi JHW/jS. DatePicker.

iVMt main.xml At+'f'^Jn 'N&fll, Jfl W DatePicker ffliWiWil, K0f>J<:

<Button Android:id="@+id/date_picker_button"

Android:layout_width="wrap content" Android:layout_height~"wrap_content" Android:text="DatePicker" />

'ALSL id Xj "date_picker button" (ftftffl, Jt-tttfiJtM^*^» "DatePickcr\

private Button.OnCiickListener date_picker button listener = new Button.OnClickListener () {

public void onClick(View v) ( Intent intent = new Intent ();

intent. setClass (Ma i .".Activity. this, DatePickerActi vi ty. class) ;

startActivity(intent); }

l^im^M r^..liScffl " DatePicker" Ri, DatePickerActi vity k, inflififiiWfflft-^Bft

-ft, fillil! Activity m\-> iKflJt onCreatc Mb'11 ffifft Xft% date_picker.xml, onCreate Ift&SMWiU KW/j<:

public void onCreate(Bundle savedlnstanceState) { super.onCreate(savedlnstanceState); setTitle("CheckBoxActivity"); setContentV Lew (P . layout.. date_picker) ;

DatePicker dp = (DatePicker)this.findViewByld(R.id.date_picker); dp.init(2009, 5, 17, null); )

A m 7-23 AutoCompleteTextView

/h f ikm date picker.xml 4' M DatePicker fflft date picker,

Jt JFSnMM^J 2009 5 IJ 17 U, 4 datepicker.xml jtfl-'|1 iSAn DatePicker fliMttWfol h

<DatePicker

Android:id-"9+id/date_ picker" Android:layout_width: "wrap content" Android: layout_height="wrap_conr.ent" />

'jiiX DatePicker Kid date_picker, 0 jfi/S.

Win A: AndroidManiiest.xml jtft'l'SEUJil ^h Activity tfj i:HHJJ, iW&nTTfr^:

<activity Android: name "DatePickerActivity"x/activity>

¿sfrfilJT'. /F^.W-ltll L'Y' .lr "DatePicker" ft'M. DatePicker

Activity in SI 7-24 ffjTjk.

ii'ftffiSi^P.M^, DatePicker

TimePicker fcfcTMj&#fflfl\ PTl*Jl4S{fcfliiii£#in iHflEDtKIffl jjft, rimePicker aift-o main.xml + -MSfflffl WfJ TimePicker iWlfli, h'ffr^:

Outton Android:id="@+id/time picker button"

Android: layout widths"wrap content." Android:layout height-"wrap_content" Android:text="TimePicker" />

'AlX ^ id %} "time picker button" fftgcffl. #"TimePicker"*

(ftui»jJstemi Oil KffrTjK:

private Button . OnC lickLj stener time picker _button_1istener -= new Button . OnClick Listener () I

public void onClick(View v) I Intent intent new IntenL();

intent.setClass(MainActivity.this, TimePickerActivity.class); st.artAct ivity (intent) ;

l-.iBiWA'fflli'^.liScffl "TimePicker" 111, m¥t M TimePicker Activity ±, fllff ffiiffWWaifl t Activity, Jf/£JC onCreate time_picker.xml, onCreateF0r>Jr<:

(¿Override public void onCreate(Bundle savedlnstanceState) { super.onCreate(savedlnstanceState); setTitle{"TimePickerActivity"); setCon tent.View (R. layout. t ime_picker) ;

TimePicker tp = (TimePicker)this.findViewByld(R.id.time picker); tp.setIs24HourView(true); )

mmu— timejpicker.xml f TimePicker MSf^,

<TimePicker Android:id="@+id/time_picker" Android:layout_width="wrap_content" Android:layout_height="wrap content"/>

AiX "time_picker"

iix/u'ft AndroidManifest.xml «I1®Ail Activity

|<activity

Android: name---"TimePi ckerAct ivity"></act ivi ty>

i&'uVm. & fr Ifll h'P-4 "TimePicker" M^W

TimePickerActivity jtnffl 7-25 fif/ji.

-FWJB, TimePicker ttHtttfcttff. £

& w,m hw «■t &ft-# a /i; ± ff ai t«jta -^ttia, ® tx7r- it-& u m » ra. % & s t

0 0

Post a comment