Home » » EditText for password, inputType="textPassword"

EditText for password, inputType="textPassword"

Written By MR HARI on Selasa, 13 Oktober 2009 | 03.08


I'm going to make a exercise of Twitter Client to post update status to Twitter. In which I need a EditText, with hiden input of password.

To achieve it, EditText with android:inputType="textPassword" can be used.The input characters will be displayed as password dots instead of themselves.

Alternatively, android:password="true" can be used. But it is deprecated and not suggested.







<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="User Name and Password"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="User Name:"
/>
<EditText
android:id="@+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Password:"
/>
<EditText
android:id="@+id/password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="What are you doing?"
/>
<EditText
android:id="@+id/whatareyoudoing"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/mySubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Submit"
/>
</LinearLayout>
Share this article :

0 komentar:

Posting Komentar

 
Support : Your Link | Your Link | Your Link
Copyright © 2013. Android Center - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger