i am doing an xml layout file, and i want to have my spinner in the right of a textview, but i am having problems… when i test the layout, my spinner is not in the correct possition, it’s a little more down and it haves very small lenght, is not 180px as i said in the layout.
there is the xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/PermissionLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/perlabel"
android:layout_marginLeft="15dip"
android:layout_below="@id/salto3"/>
<Spinner
android:id="@+id/Permission"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:prompt="@string/perlabel"
android:layout_alignBaseline="@id/PermissionLabel"
android:layout_alignParentRight="true"
android:width="180px"
android:layout_marginRight="20dip"/>
<TextView
android:id="@+id/salto4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/saltodelinea2"
android:layout_below="@id/PermissionLabel"/>
<TextView
android:id="@+id/HoursRangeLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hoursrangelabel"
android:layout_below="@id/salto4"
android:layout_marginLeft="15dip"/>
<EditText
android:id="@+id/From"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_alignBaseline="@id/HoursRangeLabel"
android:width="70px"
android:layout_alignLeft="@id/Email"
android:layout_marginRight="20dip"/>
<TextView
android:id="@+id/ToLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tolabel"
android:layout_alignBaseline="@id/From"
android:layout_toRightOf="@id/From"
android:layout_marginLeft="-10px"/>
<EditText
android:id="@+id/To"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_alignBaseline="@id/From"
android:width="70px"
android:layout_marginRight="20dip"
android:layout_alignParentRight="true"/>
Is it really necessary that all items in your layout are “Relative” to each other? It sure doesn’t appear that way from the properties you set on each item.
I would recommend trying something like a LinearLayout, and then if it is critical a certain item is Relative to another item, use a RelativeLayout inside the LinearLayout for those particular items.