Android for Beginner chapter 4: EditText

Before starting chapter 3. I hope you have read basic set up  ANDROID FOR BEGINNER CHAPTER 2 : INTRODUCTION OF BASIC UI COMPONENTS . Here we will just focus on basic  about EditText only. Android system supports EditText, which is a subclass of TextView supplied with text editing operations. We often use EditText in our Android applications in order to provide an input or text field, especially in forms.

In this example we are going to show you some commonly used EditText xml attributes and how to embody and handle an EditText in our Android apps.
Step 1 : Make New project with the name EditTextExample( You can name it anything):
Before using EditText please how to create android application and how to edit activity_main.xml 
ANDROID FOR BEGINNER CHAPTER 3: TEXTVIEW
android lad
image
image
image
 
Step 2: Now Edit activity_main.xml :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="app.androidlad.iamandroidbeginner.MainActivity">
</RelativeLayout>

Now add <EditText>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="app.androidlad.iamandroidbeginner.MainActivity">
 
</RelativeLayout>


Step 3 Try other attributes and see the result
Now lets explain the code above and the specific attributes that we defined in the XML file. It is worth to mention that there are the respective functions too, where we can call in the activity source code in order to change the characteristics of the view. Also all the attributes and methods of TextView can be used, due to subclass inheritance.
hint defines the hint text that would be displayed in the edit text. The text can be defined directly or as a reference tovalues/strings.xml resource.
singleLine sets whether the text is appeared in one line (true) or if it is wrapped into multiple ones (false).
maxLength specifies the maximum number of characters that the user could put into the text field.
digits specifies the specific numbers that are accepted to be used.
inputType declares the type of data that the user can fill in the text field. Some of the possible choices are textCapWords, email, phone etc, so the input in the text field is adjusted respectively. For multiple than one choices we should use | character for separation.
password indicates that the input is going to be a password, so the text is hidden to the user. Another way to do this, is to set the attribute inputType into
textPassword As we mentioned we can use the components of TextView, where some of them are defined to our example:
background sets the background color of the edit text. Again the color should be defined in hex encoding or as a reference to another resource.
clickable indicates if the view reacts to click events.


What you you think about this topic please let me know. You can comment below and reach me at facebook and twitter.












Previous
Next Post »

1 comments:

Click here for comments
Anonymous
admin
12 March 2022 at 20:58 ×

Android For Beginner Chapter 4: Edittext ~ Android Lad Ohm >>>>> Download Now

>>>>> Download Full

Android For Beginner Chapter 4: Edittext ~ Android Lad Ohm >>>>> Download LINK

>>>>> Download Now

Android For Beginner Chapter 4: Edittext ~ Android Lad Ohm >>>>> Download Full

>>>>> Download LINK

Congrats bro Anonymous you got PERTAMAX...! hehehehe...
Reply
avatar