EditText text alignment

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

EditText text alignment

Postby faiz.india » Mon Jul 28, 2008 12:31 pm

I am using an EditText the xml layout looks something like this

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="fill_parent">


<EditText android:id="@+id/SMSText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="true"
android:text="">
<requestFocus />
</EditText>

</LinearLayout>


When i run an activity with the above layout, it shows an EditText with the text position at the CENTER. The EditText shows uo multiple line which is one of my requirement.

My question is what property do i need to set so that my EditText text cursor starts from the first line and not from CENTER.
faiz.india
Developer
Developer
 
Posts: 32
Joined: Mon Jul 28, 2008 12:21 pm
Location: Pune - India

Top

Re: EditText text alignment

Postby ych.tiger » Wed Jul 30, 2008 1:58 am

Hi, you can try add the gravity property.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2.         <EditText android:id="@+id/SMSText"
  3.  
  4.          android:layout_width="fill_parent"
  5.  
  6.                 android:layout_height="fill_parent"
  7.  
  8.                 android:drawSelectorOnTop="true"
  9.  
  10.                 android:text=""
  11.  
  12.                <span style="font-weight: bold">android:gravity="top"></span>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
User avatar
ych.tiger
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Jul 08, 2008 4:07 am
Location: China

Re: EditText text alignment

Postby faiz.india » Wed Jul 30, 2008 6:30 am

Thanks it worked



ych.tiger wrote:Hi, you can try add the gravity property.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.         <EditText android:id="@+id/SMSText"
  2.          android:layout_width="fill_parent"
  3.                 android:layout_height="fill_parent"
  4.                 android:drawSelectorOnTop="true"
  5.                 android:text=""
  6.                <span style="font-weight: bold">android:gravity="top"></span>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
faiz.india
Developer
Developer
 
Posts: 32
Joined: Mon Jul 28, 2008 12:21 pm
Location: Pune - India

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests