<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:id="@+id/button1" android:text="Continue" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_marginRight="22dp"></Button>
<EditText android:layout_height="wrap_content" android:layout_width="150dip" android:id="@+id/editText1" android:layout_alignBaseline="@+id/textView2" android:layout_alignBottom="@+id/textView2" android:layout_alignLeft="@+id/dealerText"></EditText>
<TextView android:id="@+id/textView2" android:text="@string/dealerNoString" android:layout_height="wrap_content" android:layout_width="wrap_content" android:te开发者_StackOverflowxtStyle="bold" android:layout_below="@+id/dealerText" android:layout_marginTop="20dp"></TextView>
<TextView android:id="@+id/textView1" android:text="@string/DealerString" android:layout_height="wrap_content" android:layout_width="wrap_content" android:textStyle="bold" android:layout_alignBottom="@+id/dealerText" android:layout_alignParentLeft="true" android:layout_marginLeft="23dp"></TextView>
<EditText android:layout_height="wrap_content" android:layout_width="150dip" android:id="@+id/dealerText" android:layout_below="@+id/button1" android:layout_toRightOf="@+id/textView2" android:layout_marginTop="16dp">
<requestFocus></requestFocus>
</EditText>
<EditText android:layout_height="wrap_content" android:layout_width="150dip" android:id="@+id/editText2" android:layout_alignTop="@+id/textView3" android:layout_toRightOf="@+id/textView2"></EditText>
<TextView android:id="@+id/textView3" android:text="TextView" android:layout_height="wrap_content" android:textSize="15" android:layout_width="wrap_content" android:textStyle="bold" android:layout_below="@+id/editText1" android:layout_alignParentLeft="true" android:layout_marginTop="33dp"></TextView>
<TextView android:id="@+id/textView4" android:text="TextView" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/editText2" android:layout_alignRight="@+id/textView1" android:layout_marginTop="28dp"></TextView>
<EditText android:layout_height="wrap_content" android:layout_width="150dip" android:id="@+id/editText3" android:layout_alignBaseline="@+id/textView4" android:layout_alignBottom="@+id/textView4" android:layout_alignLeft="@+id/editText2"></EditText>
</RelativeLayout>
I used relative layout,But I have many EditTexts so ,how can I use scroll view with relative layout
Like this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView>
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:id="@+id/button1" android:text="Continue" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_marginRight="22dp"></Button>
<EditText android:layout_height="wrap_content" android:layout_width="150dip" android:id="@+id/editText1" android:layout_alignBaseline="@+id/textView2" android:layout_alignBottom="@+id/textView2" android:layout_alignLeft="@+id/dealerText"></EditText>
<TextView android:id="@+id/textView2" android:text="@string/dealerNoString" android:layout_height="wrap_content" android:layout_width="wrap_content" android:textStyle="bold" android:layout_below="@+id/dealerText" android:layout_marginTop="20dp"></TextView>
<TextView android:id="@+id/textView1" android:text="@string/DealerString" android:layout_height="wrap_content" android:layout_width="wrap_content" android:textStyle="bold" android:layout_alignBottom="@+id/dealerText" android:layout_alignParentLeft="true" android:layout_marginLeft="23dp"></TextView>
<EditText android:layout_height="wrap_content" android:layout_width="150dip" android:id="@+id/dealerText" android:layout_below="@+id/button1" android:layout_toRightOf="@+id/textView2" android:layout_marginTop="16dp">
<requestFocus></requestFocus>
</EditText>
<EditText android:layout_height="wrap_content" android:layout_width="150dip" android:id="@+id/editText2" android:layout_alignTop="@+id/textView3" android:layout_toRightOf="@+id/textView2"></EditText>
<TextView android:id="@+id/textView3" android:text="TextView" android:layout_height="wrap_content" android:textSize="15" android:layout_width="wrap_content" android:textStyle="bold" android:layout_below="@+id/editText1" android:layout_alignParentLeft="true" android:layout_marginTop="33dp"></TextView>
<TextView android:id="@+id/textView4" android:text="TextView" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/editText2" android:layout_alignRight="@+id/textView1" android:layout_marginTop="28dp"></TextView>
<EditText android:layout_height="wrap_content" android:layout_width="150dip" android:id="@+id/editText3" android:layout_alignBaseline="@+id/textView4" android:layout_alignBottom="@+id/textView4" android:layout_alignLeft="@+id/editText2"></EditText>
</RelativeLayout>
</ScrollView>
Wrapping it around!
Place the RelativeLayout inside of the ScrollView since it can only take one view. And then place the EditText's inside of the RelativeLayout. If this is what you mean.
精彩评论