I want to make something like the one below. However for some reason, the buttons are invisible. Can anyone kindly help
--------------------
txt1 txt2
--------------------
| |
| |
| |
| txtview1 |
| |
| |
| |
--------------------
|btn1| |btn2|
--------------------
layout code:
<?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">
<TextView
android:id="@+id/txt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Network Status: "/>
<TextView
android:id="@+id/txt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="updating..."
android:layout_toRightOf="@+id/txt1"/>
<ScrollView
android:id="@+id/sv1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/txt1">
<TextView
android:id="@+id/txt3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Log"/>
</ScrollView>
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:layout_below="@+id/sv1"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stop"
android:layout_toRightOf="@+id/btn1"
android:layout_below="@+id/sv1"/>
</RelativeLayout>
The problem is, that the ScrollView fills the rest of the space. You can use the fill_parent attribute, but the ScrollView has to be above the buttons. So in ScrollView, set
layout_aboveto one of the Buttons.