Hi there I want to put my EditText box above my ScrollView so the user can still scroll down but at the same time still see the EditText at a fixed view at the top how do I do that ? / /
This is my code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context=".BitActivity" >
<EditText
android:id="@+id/input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:ems="10"
android:gravity="center"
android:hint="Type In Your Value"
android:inputType="numberDecimal"
android:textColor="#2FB3E3"
android:textSize="30px" >
<requestFocus />
</EditText>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/byte1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/input"
android:gravity="center"
android:text="Please Enter a Value"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFF00"
android:textSize="40px" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
in your ScrollView
you have android:layout_alignParentTop="true"
. But the ScrollView
s parent is the RelativeLayout
meaning that it will align the top of the ScrollView
with the top of the RelativeLayout
(which is the top of the screen).
Try replacing your current ScrollView
with this::
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@id/input"
>
The key here is this line: android:layout_below="@id/input"
which align the ScrollView
s top just below the View
with id "input
"'s bottom.