Posted by : Wai Hlyan Tuesday, December 29, 2015

Text Field
°°°°°°°°°°

ဒီအခန္းအတြက္ project အသစ္ေဆာက္လိုက္ပါ။


အရင္အတိုင္းပဲ LinearLayout မွာ android:orientation ကို vertical မထားပဲ horizontal ထားလိုက္ပါ။ အဲ့့ေၾကာင္းကို ေနာက္ပိုင္းမွ ေဖာ္ျပေပးပါမယ္။ ဒီအခန္းက Email တို႔ passwordတို႔ ရိုက္တဲ့ box ေလးအေၾကာင္း ပါ။


ပထမဆံုးtutorialမွာလို android:textကို Massage လို႔နာမည္ေပးလိုက္ပါ။ <TextView......../>ရဲ႕ ေနာက္ ကေန ႏွစ္ေၾကာင္းေလာက္ ဆင္းလိုက္ပါ။ ၿပီးရင္ေအာက္ က codeေလးေတြကို ထည့္ၾကည့္ပါ။

<EditText
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

TextSize ကေသးေနတယ္ဗ်။ ဟိုးအရင္က tutorial ထဲကလို TextSize ျပင္ၾကည့္ဗ်ာ။ Size က 20sp ေလာက္ထားရင္ အိုေကတယ္။ အရင္သင္ခန္းစာေတြ ေက်ညက္ခဲ့ရင္ ျပန္ၾကည့္စရာ မလိုဘူးေပါ့ဗ်ာ။ ၿပီးရင္ run ၾကည့္ပါ။


ဂလိုေလးေပါ့။


Password ထည့္တဲ့ Text Fieldလုပ္မယ္ဗ်ာ။ အေပၚက android:text က Massage ေနရာမွာ password လို႔ ေျပာင္းလိုက္ပါ။ Edit text ကိုပဲ password လုပ္ လို႔ရတယ္ေနာ္ ဒါေပမယ့္ password႐ိုက္လိုက္ရင္ စာလံုး ေတြကေပၚေနမွာေပါ့။ password လို ႐ိုက္ၿပီးခဏ ေနတာနဲ႔ အစက္ေလးေတြျဖစ္ေအာင္ လုပ္မယ္ေနာ္။ ေစာ ေစာကထည့္ထားတဲ့

<EditText ေနာက္ကေန တစ္ေၾကာင္းဆင္းလိုက္ပါ။ ၿပီးရင္ android:inputType="textPassword" လို႔ထည့္ပါ။

code အျပည့္အစံုက ဒီလိုေနာ္။

<EditText
android:inputType="textPassword"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>


ဒီလိုအစက္ေလးေတြျဖစ္သြားတာေပါ့။


ေနာက္ထပ္ စာလံုးpassword ၿပီးရင္ ဂဏန္းpassword လုပ္ၾကည့္မယ္ေနာ္။ ေစာေစာကထည့္ထားတဲ့ android:inputType ကိုဖ်က္ၿပီး android:inputType="numberPassword" လို႔အစားထိုး လိုက္ပါ။ အျပည့္အစံုက ဒီလိုေလးေနာ္။

<EditText android:inputType="numberPassword"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

ၿပီးရင္ Run ၾကည့္လိုက္ပါ။


ဒီလို​ေလး​ေနာ္​။


ဒီတစ္ခါ Email ထည့္တဲ့ Box ေလးလုပ္မယ္ေနာ္။ အ ေပၚကအတိုင္းပဲ android:text မွာ Password ေနရာမွာ Email အစားထိုးလိုက္ပါ။ ၿပီးေတာ့ android:inputType ကိုဖ်က္ၿပီး android:inputType="textEmailAddress" လို႔အစားထိုး လိုက္ပါ။ အျပည့္အစံုက ဒီလိုေနာ္။

<EditText
android:inputType="textEmailAddress"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

ၿပီးရင္ Run ၿပီး စာလံုးေလးေတြ ႐ိုက္ထည့္ၾကည့္ပါ။


Keyboard မွာ @ နဲ႔ .com ခုပ္​​ေလးပါလာပါလိမ္​့မယ္​။


ဒီတစ္ခါ နာမည္ေရးဖို႔ box ေလးေရးမယ္ေနာ္။ အ ေပၚကအတိုင္းပဲ android:text မွာ Email ေနရာမွာ Name အစားထိုးလိုက္ပါ။ ၿပီးေတာ့ android:inputType ကိုဖ်က္ၿပီး android:inputType="textPersonName" လို႔အစားထိုး လိုက္ပါ။ အျပည့္အစံုက ဒီလိုေလးေနာ္။

<EditText
android:inputType="textPersonName"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

run ၾကည့္လိုက္ေနာ္။


ဒီလို​ေလး​ေနာ္​။


ေနာက္တစ္ခါ ဖုန္းနံပါတ္ ထည့္တဲ့ box ေလးလုပ္မယ္။ အေပၚမွာ အမ်ားႀကီးလုပ္ၿပီးၿပီဆိုေတာ့ မွတ္မိေနေလာက္ ပါၿပီ။ ေနာက္မွာလဲ က်န္ေသးေတာ့ အတိုေကာက္ပဲ ေျပာၾကမယ္။ text နဲ႔ input လို႔ပဲ ေျပာေတာ့မယ္။ ရလားမသိဘူး။ ရရမရရ လုပ္ၿပီ။ text မွာ Phone ထည့္ inputမွာ android:inputType="phone" လို႔ေျပာင္ းၿပီး Run မယ္ဗ်ာ။


ဂဏန္​း​ေလး​ေတြပဲ​ေပါ့။


ဒါကေတာ့ အခ်ိန္ထည့္တဲ့ box ေပါ့။ text မွာ Time| input မွာ android:inputType="time" လို႔ထည့္ၿပီး Run ၾကည့္လိုက္ေနာ္။


အခ်ိန္​နဲ႔ဆိုင္​တာ​ေလး​ေတြပဲ ​ေပၚလာတာ​ေပါ့​ေနာ္​။


ေနာက္ထပ္က်န္ပါေသးတယ္။ သိပ္ၿပီးအသံုးမလိုလို႔ ထားခဲ့တာပါ။ အသံုးမ်ားတာေလးေတြပဲ ထည့္ေပးလိုက္ ပါတယ္။

အကုန္လံုးကို app တစ္ခုထဲမွာထည့္နည္းက Layout အေၾကာင္းမ႐ွင္းရေသးလို႔မေျပာေတာ့ပါဘူး။ တကယ္ လို႔လုပ္ခ်င္ရင္ main.xml က အကုန္လံုးကိုဖ်က္ၿပီး ေအာက္က 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="vertical">

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text Password"
android:textSize="20sp"/>

<EditText
android:inputType="textPassword"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

</LinearLayout>

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Number Password"
android:textSize="20sp"/>

<EditText
android:inputType="numberPassword"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

</LinearLayout>

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
android:textSize="20sp"/>

<EditText
android:inputType="textEmailAddress"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:textSize="20sp"/>

<EditText
android:inputType="textPersonName"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

</LinearLayout>

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phone"
android:textSize="20sp"/>

<EditText
android:inputType="phone"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

</LinearLayout>

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
android:textSize="20sp"/>

<EditText
android:inputType="time"
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"/>

</LinearLayout>

</LinearLayout>

အဆင္မေျပတာေလးေတြ Comment မွာေမးႏိုင္ပါတယ္ ။



သင္​၏comment တစ္​​ေၾကာင္​းသည္​ ကြၽန္​ုပ္​အတြက္​ ​ေနာက္ပိုစ္​့မ်ားတင္​ရန္​ အား​ေဆးတစ္​ခြက္​ ျဖစ္​​ေစပါလိမ္​့မည္​။

{ 1 မွတ္​ခ်က္​မ်ား... read them below or add one }

  1. ေက်းဇူးအရမ္းတင္တယ္ဗ်ာ

    ReplyDelete

လာ​ေရာက္​ၾကည္​့႐ွႈသူမ်ား

Welcome to My Blog

Zawgyi-Unicode

Designed by အိမ္​​ေ႐ွ႕မင္​းသား-နည္​းပညာ. Powered by Blogger.

Random Posts

Contact Form

Name

Email *

Message *

Thankful

Popular Posts

- Copyright © Myanmar Android Tutorials For Beginners -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -