Professional Documents
Culture Documents
Bai 3 - Giao Dien Nguoi Dung
Bai 3 - Giao Dien Nguoi Dung
N%i dung
!!Giao di&n ng'(i dng !!View
"!Text, Button, List, Grid,
!!Layout
"!LinearLayout, AbsolutLayout, TableLayout,
!!Th)c hnh
N%i dung
!!Giao di&n ng'(i dng !!View
"!Text, Button, List, Grid,
!!Layout
"!LinearLayout, AbsolutLayout, TableLayout,
!!Th)c hnh
N%i dung
!!Giao di&n ng'(i dng !!View
"!Text, Button, List, Grid,
!!Layout
"!LinearLayout, AbsolutLayout, TableLayout,
!!Th)c hnh
View
!!L4p View cung c*p cc kh6i c0 b7n cho cc thnh ph8n giao di&n ng'(i dng. !!M%t View l m%t vng ch9 nh:t trn mn hnh, c th; v< ln v t'0ng tc. !!View l l4p c0 b7n cho widgets ! t5o ra cc ,6i t'-ng giao di&n (text, button, etc.)
!!Ch A: Android ch?u trch nhi&m cBn chCnh, sDp x>p v v< cc ,6i t'-ng, ta khng c8n t) g.i cc method ny.
9
!!UI events
"!onSomethingListener
!OnClickListener !OnTouchListener !OnKeyListener !
10
View > V d3
12
TabView
GridView
FrameLayout
13
WebView
MapView
SurfaceView
14
N%i dung
!!Giao di&n ng'(i dng !!View
"!Text, Button, List, Grid,
!!Layout
"!LinearLayout, AbsolutLayout, TableLayout,
!!Th)c hnh
15
Layout
!!E?nh nghFa v? tr cc ph8n t2 quan h& v4i nhau
"!c"nh nhau "!trn, d+2i "!b&ng, l+2i, danh sch "!
16
17
18
19
20
22
N%i dung
!!Giao di&n ng'(i dng !!View
"!Text, Button, List, Grid,
!!Layout
"!LinearLayout, AbsolutLayout, TableLayout,
!!Th)c hnh
23
24
25
ChuGn b? 3 icons, T5o ./res/drawable (n>u ch'a c) Copy icons vo ./res/ drawable
26
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- When selected, use grey --> <item android:drawable="@drawable/ic_tab_artists_grey" android:state_selected="true" /> <!-- When not selected, use white--> <item android:drawable="@drawable/ic_tab_artists_white" /> </selector>
27
#!
<?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/ apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp"> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp" /> </LinearLayout> </TabHost>
28
nh x5 resource vo tab
Ch.n Tab 2
29
30
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:textSize="20sp" > </TextView>
31
33
Bi t:p
1.! Th)c hi&n l5i 2 v d3 vJ tablayout v listview 2.! Vi>t ch'0ng trnh hi;n th? 1 cu hKi v 4 ,p n. Khi ng'(i dng nh*n nt tr7 l(i th hi&n thng bo ,ng hay sai (Dng RadioButton v RadioGroup) 3.! Vi>t ch'0ng trnh thu nh:p thng tin ng'(i dng (tn, tu=i, gi4i tnh, ngy thng nBm sinh), khi nh*n nt submit th hi;n th? l5i thng tin v+a nh:p (dng DatePicker cho ngy thng nBm sinh)
34