You are on page 1of 5
Trong bai nay minh sé huéng din cach tgo I custom ViewGroup, sir dung ViewGroup nay vao ListView, va cudi cing lA tao 1 Option Menu. Day ciing sé 1a bai cudi cing minh viét vé lim vige véi View, cdc bai sau sé chuyén qua Intent va BroadCast Receiver. Custom ViewGroup o& ViewGroup théng thudng ching ta hay gp 14 LinearLayout, Layout. Xay dung custom ViewGroup cho phép ching ta tao 1 tap cde wi gc sip xép theo y muén réi dua vao str dung. © Yéu cau: Xay dung img dung dang To Do Li 0 ip vao ndi dung céng vige va thai gian thy hign cong vige réi dua Rep, viée. Cho phép xéa cde céng vige khéi list. Project name: Example 3 Build Target: Chon Android 1.5 @ Application name: Example 3 & Package name: at.exam Create Activity: Example => Kich nit Finish. B2: Xay dung custom view grouip trong XML. Bi ti res\layout tao | file XML méi [A list.xml. G6 ndi ang au vo Ma: &, android: layout_height="wrap_content" android:text="" android:paddingTop="45px" android:paddingRight="10px" (> ~ Cextview & android: id= (ajeime content" android: tex "16px" android: lay’ idth="wrap_content" android height="wrap_content" androi 1" andr tColor="@color/time_color" /> ~ Custom ViewGro hing ta 6 day kha don gin, d6 la 1 LinearLayout chita 2 thanh phan: 1 x va | LinearLayout khac gém 2 TextView dé hién thi ndi dung cong viée-v4 jhoi gian. B3: Da xong giao dign cho custom ViewGroup, chiing ta sé thiét ké giao dign cho chuong trinh trong main.xml. G day minh ding Iai giao dign cia Example 2 trong Si ») SS ® android:id: na android: layowt,widtt android: t_height= araroyaitone=eat sina androi string/button_conte euise d:id="@+id/list" and¥did:layout_width="£ill_parent" android: layout_height="wrap_content" on" wrap content" ap_content" > 0 file colors.xml trong res\value: work_color">#ffffff time _color">#cccece hint_color">#cccccc work_color la mau ciia n6i dung céng vige trong list. time_color mau cia thoi gian céng vige. hint_color mau cia text hint (dang huéng din) cae EditText.

You might also like