Sexy Text/Input Fields

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Sexy Text/Input Fields

Postby houba » Wed Apr 22, 2009 8:23 pm

Hello everyone,

This is my 1st post here. I'm really pleased to meet you all.

Does anyone here know how to create a text input field (in XML) that has the field name displayed IN the field element.

For example:

Let's say you create a field called "Name" and next to it, you put an INPUT FIELD where someone writes their name.

OK.. but what I want is where the word "Name" appears IN the [INPUT FIELD]

How do you do that?

a typical example that I'd like to imitate is that in the phone book. If you go to your contacts, and do "ADD NEW CONTACT", the field for first and Last name has the words "First and Last" written the field where you enter the First and Last name of the user.

As soon as you start typing the First name, the field title disappears.

Im sorry for rambling on, but i'd love help with this, and I'm not entirely sure if I was clear or not.

Many thanks for any help you can provide.
houba
Freshman
Freshman
 
Posts: 8
Joined: Wed Apr 22, 2009 8:16 pm

Top

Postby mangaluve » Wed Apr 22, 2009 10:58 pm

Use the android:hint property of EditText, something like

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <EditText android:hint="Sexy Field" android:id="@+id/NameField" android:layout_width="200px" android:layout_height="wrap_content"></EditText>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
mangaluve
Experienced Developer
Experienced Developer
 
Posts: 82
Joined: Mon Mar 23, 2009 8:59 pm

Postby houba » Wed Apr 22, 2009 11:33 pm

Thanks a lot! I'll try that.
houba
Freshman
Freshman
 
Posts: 8
Joined: Wed Apr 22, 2009 8:16 pm

Which books would you recommend?

Postby houba » Wed Apr 22, 2009 11:50 pm

Hi Mangalov,

THanks. It worked :)
YAY

WHich books would you recommend?

Thanks
houba
Freshman
Freshman
 
Posts: 8
Joined: Wed Apr 22, 2009 8:16 pm

Postby mangaluve » Thu Apr 23, 2009 8:40 am

Hi,

Well I still consider myself a novice at Android and I haven't really read any books so I wouldn't know. One thing I can recommend for sure is to make sure you know where to find the source code for the standard Android apps and the Android framework. I found the hint-property I wrote about by looking at the source for the Contact-app. But that's just me, there's probably a ton of good books out there...
mangaluve
Experienced Developer
Experienced Developer
 
Posts: 82
Joined: Mon Mar 23, 2009 8:59 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 3 guests