Android Layout Can't get EditText to line up in LinearLayout -


i created layout dialog box. want same width zip code edittext , email edittext edit boxes , want them align left.

so should like:

email: _______

zipcode: _______

correction: above not showing correctly on stackoverflow. lines above should , left justified. have same display problem on forum. put spaces after email: still not align.

instead getting email wider zip code. changed both edittext same input type no luck. if textview has same text align if both zip code:. if pad email text edit spaces layout manager seems know , expand email edittext larger zip code. frustrating!

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

<textview     android:id="@+id/messagemsg"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:textsize="@dimen/text_21px"     android:textcolor="@color/white"     android:text="lorum ipsum afasdf lajsdfasldfjald:"     android:padding="10dip"     /> <linearlayout     android:layout_width="fill_parent"     android:layout_height="wrap_content">     <textview            android:id="@+id/emaildescriptor"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:textsize="@dimen/text_21px"         android:textcolor="@color/white"            android:padding="10dip"                          android:text="email:    "/>     <edittext android:id="@+id/emailid"          android:inputtype="textemailaddress"          android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:padding="10dip"            android:layout_margin="10dip"                        android:textsize="@dimen/text_21px" /> </linearlayout> <linearlayout     android:layout_width="fill_parent"     android:layout_height="wrap_content">        <textview            android:id="@+id/zipcodedescript"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:padding="10dip"         android:textsize="@dimen/text_21px"         android:text="zip code: "         android:textcolor="@color/white"/>     <edittext android:id="@+id/zcode"          android:inputtype="textemailaddress"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:padding="10dip"         android:layout_margin="10dip"         android:textsize="@dimen/text_21px"/> </linearlayout> 

as @aedonetlira said, can hardcode position. increase margin attribute left side make them align.

alternatively, use attribute,

android:layout_alignleft="@id/your_other_edittext" 

a third idea, make text boxes labels same "width", following edittexts should align.

finally, use weighted nests layouts. bad idea. poor performance & excessively confusing. =)


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -