နည္​းပညာ​ေလ့လာမူ႔

Wednesday, January 18, 2017

lesson 6

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 ​ေလး​ေပၚလာမွာ​ေပါ့​ဗ်ာ။

No comments:

Post a Comment