Reputation: 5413
Under my relative layout, I put in a Textview
and then a TextField
(both of them are aligned on the left hand side).
However, the TextField
can not stretch to the width I want (well, it would stretch all the way if it touches the right hand side but not anywhere else).
How can I achieve that the Textfield stretches to any arbitrary length?
Textfield
is the same as EditText
.
<?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" android:weightSum="1">
<TextView android:id="@+id/textItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:background="#00000000"
android:textColor="#ffffffff"
android:textSize="22sp"
android:text="Settings"
android:enabled="false"
>
</TextView>
<RelativeLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/relativeLayout1" android:layout_weight="1.03">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:id="@+id/textView1" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_marginLeft="20dp" android:layout_marginTop="18dp"></TextView>
<EditText android:layout_width="wrap_content" android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_below="@+id/textView1" android:layout_alignLeft="@+id/textView1" android:layout_marginTop="18dp">
<requestFocus></requestFocus>
</EditText>
</RelativeLayout>
</LinearLayout>
Upvotes: 0
Views: 2364
Reputation: 3411
android:layout_width="50dp". set the value to whatever size you want it to be.
Upvotes: 1