I am trying to make an Android interface, but I have a little overlapping issue with the views.
Here is my code. It is in a Tab, but I cut the Tab-part away. If you need it, I'll add it.
UPDATE: I forgot to write that I have a lot of TextView, not only one
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<!-- A lot of TextView as the one above -->
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/add"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_width="fill_parent"
android:text="@string/add" />
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
And this is what it outputs. As you can see, in the bottom, the text goes behind the button, but I want to have them in two different layouts
Try to position it relatively above the button.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:orientation="vertical"
android:layout_above="@+id/InnerRelativeLayout" //Add this
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/add"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_width="fill_parent"
android:text="@string/add" />
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
Don't use RelativeLayout unless you absolutely have to. Ever. I know that's not a popular opinion, but that's what I tell everybody.
I assume you want the scroll to take up as much space as possible, then have the button at the bottom?
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="1">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/add"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/add" />
</LinearLayout>
I think you can dump the LinearLayout inside the ScrollView, assuming you only have 1 child (the TextView)