Archive for December 2015

Lesson 5 (Text Field)

Tuesday, December 29, 2015
Posted by Wai Hlyan

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 တစ္​​ေၾကာင္​းသည္​ ကြၽန္​ုပ္​အတြက္​ ​ေနာက္ပိုစ္​့မ်ားတင္​ရန္​ အား​ေဆးတစ္​ခြက္​ ျဖစ္​​ေစပါလိမ္​့မည္​။

Lesson 4 (ON-OFF Buttons)

Sunday, December 27, 2015
Posted by Wai Hlyan

ON-OFF Button

Toggle Button ဆိုတာ ဖုန္​းအခ်က္​ျပမီးတို႔ ဘာတို႔မွာသံုးတဲ့ အဖြင္​့အပိတ္​ ခလုပ္​ပံုစံျဖစ္​ပါတယ္​။​ <TextView project အသစ္​လုပ္​လိုက္​ပါ။ ဒီနားမွာနည္​းနည္​း​ေျပာခ်င္​ပါတယ္​။ project အသစ္​​ေရြးတဲ့အခါ ကြၽန္​​ေတာ္​ပံုမွာျပထားတဲ့ အလယ္​ကဟာကို​ေရြးပါ။


ဘာျဖစ္​လို႔လဲဆို​ေတာ့ ကြၽန္​​ေတာ္​​ေရးတဲ့ ဟာ​ေတြနဲ႔ လြဲ​ေနမွာစိုးလို႔ပါ။

ကဲ.... မူရင္​း​ေခါင္​းစဥ္​ကို ျပန္​သြားၾကတာ​ေပါ့။


project အသစ္​လုပ္​လိုက္​ပါ။ ၿပီးရင္​ ပံုမွာျပထားတဲ့အတိုင္​း ​ေအာက္​ကcode ​ေတြကုိထည္​့လိုက္​ပါ။

<ToggleButton
android:layout_height="wrap_content"android:layout_width="wrap_content"/>

Run ၿပီးခလုပ္​​ေလးႏိွပ္​ၾကည္​့ပါ။


ON-OFF ခလုပ္​​ေလးရပါလိမ္​့္​။


ေနာက္​ထပ္​ခလုပ္​တစ္​ခုလုပ္​ဖို႔ ​ေစာ​ေစာကထည္​့ထားတဲ့ code ​ေနာက္​က​ေန ႏွစ္​​ေၾကာင္​း​ေလာက္​ဆင္​းလိုက္​ပါ။ ၿပီး​ေတာ့ ဒီ​ေအာက္​က code​ေလး​ေတြထည္​့ၾကည္​့ပါ။

<Switch
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>


ပံုထဲကအတိုင္​း ရ႐ွိပါလိမ္​့မယ္​။


အဲ့code ​ေအာက္​က​ေနၿပီး ႏွစ္​​ေၾကာင္​း​ေလာက္​ထပ္​ဆင္​းၿပီး ​ေအာက္​က code​ေလး​ေတြထပ္​ ထည္​့ၾကည္​့ပါ။

<CheckBox
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="mark here"/>

Run လို႔ရပါၿပီ။ အဲ့code​ေတြမွာ android:text="mark here" ဆိုတဲ့​ေနရာမွာ mark here ဆိုတာ ဒီမွာအမွန္​ျခစ္​ပါ​ေပါ့။ အဲ့​ေနရာမွာမိမိစိတ္​ႀကိဳက္​ ထည္​့သြင္​းလို႔ ရပါတယ္​။


ဒီလို​ေလး​ေပါ့။


ၿပီးရင္​ အဲ့code​ေတြရဲ႕​ေနာက္​က​ေန ႏွစ္​​ေၾကာင္​း​ေလာက္ ထပ္​ဆင္​းလိုက္​ပါ။ ၿပီးရင္​ဒီ​ေအာက္​ကcode​ေလး ထပ္​ထည္​့ၿပီး run ၾကည္​့မယ္​​ေနာ္​။

<RadioButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Radio Button"/>

ဒီမွာလည္​းအ​ေပၚအတိုင္​းပဲ android:text ​ေနရာမွာမိမိစိတ္​ႀကိဳက္​ထည္​့လို႔ ရတယ္​​​ေနာ္​။​


ဒီပံု​ေလးရ႐ွိပါလိမ္​့မယ္​။


ေနာက္​ဆံုးတစ္​ခုအ​ေနနဲ႔ အဲ့code ရဲ​ေနာက္​က​ေန ႏွစ္​​ေၾကာင္​း​ေလာက္ ထပ္​ဆင္​း​ေပးၿပီး ​ေအာက္​ကcode ထည္​့ၿပီး run ၾကည္​့ပါ။

<SeekBar
android:layout_height="wrap_content"
android:layout_width="150dp"/>

သူက်​ေတာ့ android:layout_width ကို wrap_content လုပ္​လို႔မရ​ေတာ့ပါ wrap_content ဆိုလွ်င္​ bar မွာအလြန္​တိုသြားပါလိမ္​့မယ္​။ ဒါ့​ေၾကာင္​့ 150dp ထားလိုက္​ပါတယ္​။ 150dp ​ေနရာမွာ သင္​့စိတ္​ႀကိဳက္​ ​ေျပာင္​းလဲႏိုင္​ပါ တယ္​။ ဤwrap_content အ​ေၾကာင္​းကို ​ေနာက္​ပိုင္​းတြင္​ ႐ွင္​းလင္​း​ေပးသြားပါမည္​။


ဒီလို​ေလးပါပဲ။

ဒီ​ေန႔တင္​သြားတဲ့ အ​ေၾကာင္​းအရာက ​ေလ့လာသူ​ေတာ္​​ေတာ္​မ်ားမ်ား ​ေတြ႔ဖူးၿပီးသား​ေတြပါပ။ဲ အဲ့လိုခလုပ္​​ေတြ ဘယ္​လိုလုပ္​လဲဆိုတာ သိ​ေအာင္​လို႔ပါ။ ​ေနာက္​ထပ္​လည္​း ထပ္​မံတင္​​ေပးသြားပါမည္​။



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

Lesson 3 (Button)

Saturday, December 26, 2015
Posted by Wai Hlyan

Lesson (3)

Butoon

Lesson 2 က Tutorial အတိုင္​းျပန္​သြားပါ။

Project အသစ္​လုပ္​ပါ။ Project အသစ္​လုပ္​နည္​းကို တင္​​ေပးၿပီးသားပါ။ မသိရင္​

★ ★ ဒါကိုႏိွပ္​ပါ ★ ★





ဒီမွာ project အသစ္​လုပ္​တိုင္​း <LinearLayout ​......./>​​ မွာ
android:orientation="vertical"
ပါလား​ၾကည္​့ပါ။ မပါရင္​"center"​ ေနာက္​ကထည္​့ပါ။


ပံုမွာ ျပထားတဲ့ အတိုင္​း
<TextView..........."Hi World"/>
ရဲ​႕ ေနာက္​က​ေန ႏွစ္​​ေၾကာင္​း​ေလာက္ ​ဆင္​းလိုက္​ပါ။ ၿပီ​းေတာ့ ​ေအာက္​က code​ေလး​ေတြ ထည္​့လိုက္​ပါ။

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exit"/>

ၿပီးရင္​စမ္​းၾကည္​့ပါ။




Exit ကိုႏိွပ္​ၾကည္​့ပါ။ သာမန္​အားျဖင္​့ Exit ကိုႏိွပ္​ရင္​ ထြက္​သြားမွာျဖစ္​ပါတယ္​။ ဒီမွာႏိွပ္​ရင္​ ဘာမွမျဖစ္​ပါဘူး။ ဘာျဖစ္​လို႔လဲဆို​ေတာ့ ဒါ xml file​ေလ ပံုစံပဲ​ေပၚမွာပါ ဘာမွမလုပ္​​ေဆာင္​ႏိုင္​ပါဘူး။


အခု​ေရးလိုက္​တဲ့ အ​ေပၚက code ​ေတြရဲ​့​ေနာက္​မွာ ႏွစ္​ဆင္​့​ ​ေလာက္​ထပ္​ဆင္​းလိုက္​ပါ။

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Help"/>

အဲ့ code ကို ထပ္​ထည္​့လိုက္​ပါ။




Button ႏွစ္​ခုရပါၿပီ။


ေနာက္​ထပ္​ button 3 ခု​ေလာက္​ထပ္​လုပ္​ၾကည္​့ပါ။ နာမည္​​ေတြ ကို​ေတာ့ android:text ​ေနာက္​မွာ ​ေရး​ေပးရပါမယ္​။

button ကိုColor တင္​ပါမယ္​။



<Button ရဲ႕​ေနာက္​က​ေန တစ္​​ေၾကာင္​းဆင္​းလိုက္ပါ။အဲ့မွာ ​
android:background="#15BDE7"
ကိုထည္​့ပါ။


ၿပီးရင္​စမ္​းၾကည္​့ပါ။


​ေနာက္​ထပ္​ မိမိႏွစ္​သက္​ရာ Color code ​ေတြထည္​့ၿပီး​ေရးသားႏိုင္​ပါတယ္​။Color code ထည္​့နည္​းကို Lesson 2 မွာတင္​​ေပးၿပီးသား​ေနာ္​။

လက္​သည္​ခ်ည္​းပဲအားမကိုနဲ႔ ကိုယ္​့ဟာကိုယ္​ညႇစ္​အား​ေလး သံုးဦး :-) :-)



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

How To New Project.

Thursday, December 24, 2015
Posted by Wai Hlyan

Apk အသစ္​ ထပ္​လုပ္​နည္​းနဲ႔ apk နာမည္​ျပင္​နည္​း

ကြၽန္​​ေတာ္​တို႔လုပ္​ခဲ့တဲ့ အရင္​ tutorial ​ေတြမွာ ပထမတစ္​ခုလုပ္​ၿပီး ​ေနာက္​တစ္​ခုထပ္​လုပ္​ရင္​ အရင္​apk ကပ်က္​သြားတယ္​​ေလ။ အဲ့တာဘာျဖစ္​လို႔လဲလို႔ လာ​ေမးၾကလို႔ တင္​​ေပးလိုက္​ပါတယ္​။ ဘာျဖစ္​လို႔လဲဆို​ေတာ့ package Name တူ​ေနလို႔ပါ။ package name ဆိုတာ ဥပမာ com.mmapptutorial.myapp လိုမ်ိဳး​ေပါ့။ ပထမtutorial စလုပ္​​ေတာ့ နာမည္​ႏွစ္​ခုထည္​့ရတယ္​​ေလ။ မွတ္​မိလားမသိဘူး။ အ​ေပၚက Name ရယ္​ package name ​ေပါ့။ အဲ့မွာ N​ame ကို အဂၤလိပ္​လိုပဲ​ေရးလို႔ရတယ္​​ေလ Space bar ခံလို႔ မရဘူး​ေလ အဲ့တာကို စိတ္​ႀကိဳက္​ ျမန္​မာလိုျဖစ္​ျဖစ္​ အဂၤလိပ္​လိုျဖစ္​ျဖစ္​ ျပင္​တဲ့နည္​းပါ။ အရင္​ဆံုး ​ေအာက္​ကပံုမွာ ျပထားတဲ့အတိုင္​း ဝင္​လိုက္​ပါ။





အ​ေပၚက ပံုမွာျပထားတဲဟာ​ေလးကို Create new project ​ေပၚတဲအထိႏိွပ္​ပါ။



အဲ့လို​ေပၚလာရင္​ အဲ့့တာကိုႏိွပ္​ပါ။




အရင္​က​ေပးထားတဲ့ package name နဲ႔မတူတာ​ေပး​ေပါ့။

.


နာမည္​စိတ္​ႀကိဳက္​​ေျပာင္​းနည္း​​





Value ကို႐ွာပါ။




ဝိုင္​းျပထားတဲ့​ေနရာမွာ စိတ္​ႀကိဳက္​ျပင္​ၿပီး Run ၾကည့္​ပါ။

သင္​ရဲ႕ Comment တစ္​​ေၾကာင္​းသည္​ ကြၽန္​ုပ္​​ေနာက္​ post မ်ားတင္​ရန္​ အား​ေဆးတစ္​ခြက္​ျဖစ္​ပါသည္​။


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

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 -