Pages

Thursday, June 2, 2011

EditText for password, inputType="textPassword"


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>

2 comments:

  1. Imaginative design, integrated marketing, and information flows will help you target niche client groups. mobile websites for businesses
    droid application development

    ReplyDelete
  2. It's not scripted. It isn't a monologue. Mobile advertising and apps have added to the new, online conversation you have to start with consumers mobile business apps.
    ipad application design

    ReplyDelete

Popular Posts