Reputation: 1482
I tried multiple solution but none seem to work. Layout:
--------------------
|btn1| txt1 |btn2|
--------------------
| |
| |
| |
| txtview1 |
| |
| |
| |
--------------------
btn1 - top left aligned - decrease txt1
btn2 - top right aligned - increase txt1
txt1 - top center aligned - text/number entered with code
textview1 - client aligned with vertical scrollbar, if needed - text entered with code
Upvotes: 1
Views: 9526
Reputation: 11
You should also align the second button to the right.
Your version places the second button over the first one...
Example:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="back"/>
<TextView android:id="@+id/txt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="txt1"/>
<Button android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="btn2"/>
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/button1">
<TextView android:id="@+id/txt2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/button2"
android:text="txt2"/>
</ScrollView>
</RelativeLayout>
Upvotes: 1
Reputation: 12142
Try this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="btn1"/>
<TextView
android:id="@+id/txt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="txt1"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="btn2"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/btn1">
<TextView
android:id="@+id/txt2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="txt2"/>
</ScrollView>
</RelativeLayout>
Upvotes: 3