Lesson 6 (Hint Text)
Lesson ေတြ ျပန္စၾကတာေပါ့။ Page က Admin အကိုေတြ ျပန္လာလို႔ ခြင့္ယူတာ နည္းနည္းမ်ားသြားတယ္။ :-P :-P
Lesson 6 ကေတာ့သိပ္ေထြေထြထူးထူး မ႐ွိပါဘူး Lesson 5 က Text Field လက္က်န္ေလးပါ။ ဥပမာ Google apk လိုမ်ိဳးပဲ။ Text Field မွာ အေရာင္မွိန္မွိန္ေလးနဲ႔ စာ႐ိုက္လိုက္ရင္ အဲ့စာေလးက ေပ်ာက္သြားတဲ့ စာေလးေပါ့။ ဒီေလာက္ဆို မ်က္စိထဲေပၚလာေလာက္ၿပီးေပါ့။
-ဟုကဲ့
(ကြကိုယ္ပဲေျဖလိုက္တယ္)
အရင္ဆံုးLesson 5 က Text Field ေလးတစ္ခုလုပ္လိုက္ပါ။ မွတ္မိေသးပါတယ္ေနာ္။ မမွတ္မိရင္ျပန္ၾကည့္ေပါ့ဗ်ာ။ အဲ့မွာ <EditText ေနာက္ကေန တစ္ေၾကာင္းဆင္းလိုက္ၿပီး
android:hint="Type your name" အဲ့တာေလးထည့္ၾကည့္ေပါ့။ Type your name ဆိုေတာ့ သင့္နာမည္ေရးပါေပါ့။ code အျပည့္အစံုကို အေပၚက ပံုမွာ ၾကည့္ပါ။ ၿပီးရင္ Run ၾကည့္ေပါ့။
ဒီလိုမွိန္မွိန္ေလးေပၚေနမယ္ေနာ္။ စာ႐ိုက္လိုက္ရင္ auto ေပ်ာက္သြားလိမ့္မယ္။
ဒီတစ္ခုက်ေတာ့ ဥပမာ Browser apk ေလးလုပ္မယ္ေပါ့။ Browser apk မွာ Website address ေရးတဲ့ Box ေလးလုပ္မယ္ေပါ့။ အဲ့က်ရင္ ေ႐ွ႕ဆံုးမွာ Website address ေတြရဲ႕အစ http:// ေလး႐ိုက္စရာမလိုေအာင္အစတည္းက ထည့္ေပးထားမယ္ေနာ္။ အဲ့လိုလုပ္မယ္ဆို <EditText ေနာက္ကေန တစ္ေၾကာင္းဆင္းၿပီး android:text="http://" ဆိုၿပီးထည့္ေပးလိုက္မယ္ေပါ့။ ၿပီးေတာ့ inputType ကို textUri လို႔ေပးလိုက္ေပါ့။ android:inputType="textUri" ေလးေပါ့ အဲ့က်ရင္ Keyboard မွာ .com ဆိုတဲ့ခလုပ္ေလးပါလာလိမ့္မယ္ေပါ့။
Code အျပည့္အစံုက
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address"
android:textSize="20sp"/>
<EditText
android:layout_height="wrap_content"
android:inputType="textUri"
android:ems="10"
android:layout_width="wrap_content"
android:text="http://"/>
</LinearLayout>
ၿပီးရင္ Run ၾကည့္ေပါ့။
ပံုမွာေတြ႕ရတဲ့အတိုင္းပဲ http://ေလး auto ပါေနလိ္မ့္မယ္။
အခုကြၽန္ေတာ္ ေပါက္ေပါက္႐ွာ႐ွာေတြးမိလိုက္လို႔ ထပ္ျဖည့္ေပးလိုက္ပါတယ္။ အဲ့ဒါက android:text နဲ႔ android:hint နဲ႔တြဲသံုးၾကည့္တာေပါ့။ အေပၚက project ကိုပဲျပန္ဖြင့္ၿပီးေတာ့ android:hint="Web Address" လို႔ထည့္ၾကည့္လိုက္ပါ။
Code အျပည့္အစံုက
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address"
android:textSize="20sp"/>
<EditText
android:layout_height="wrap_content"
android:inputType="textUri"
android:ems="10"
android:layout_width="wrap_content"
android:text="http://"
android:hint="Web Address"/>
</LinearLayout>
ၿပီးရင္Run ၾကည့္ပါ။
ေတြ႕ရတဲ့အတိုင္းပဲ http://ကေပၚေနမွာျဖစ္ၿပီး http://ကိုဖ်က္လိုက္ရင္ေတာ့ Web Address ဆိုတဲ့ hint ေလးေပၚလာမွာေပါ့ဗ်ာ။
အဆင္မေျပတာေလးေတြ comment မွာေမးသြားႏိုင္ပါတယ္။
သင္၏comment တစ္ေၾကာင္းသည္ ကြၽန္ုပ္အတြက္ ေနာက္ပိုစ့္မ်ားတင္ရန္ အားေဆးတစ္ခြက္ ျဖစ္ေစပါလိမ့္မည္။








goodတယ္ဗ်ာ
ReplyDelete