How to make one part of view (relativelayout) scroll, but another part not move?

I have a RelativeLayout that is a detail page for search results. It displays a bunch of different TextViews, has a table or two, and also holds a SupportMapFragment. I want that portion to be scrollable. I also have a LinearLayout that holds an EditText and a Button at the bottom of the view that should always be visible at the bottom. It's small, maybe an 1/8th of the total view height, and I just want it to always stay there.

I tried to wrap the layout I want scrolling in a ScrollView, leave the other layout out of that, and then wrap the whole thing in a RelativeLayout. The yields a scrollbar, but it doesn't move more than just a tiny, tiny bit, and when it does, there is a little black space revealed where the SupportMapFragment moves from.

How can I set up my layouts to scroll the portion I want scrolling, and leave the other portion alone? Do I need to convert this whole activity to a FragmentActivity?

The layout file I'm wrangling is here:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/detailFragment"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#D0E4F7"
    android:paddingBottom="5dp"
    android:paddingLeft="12dp"
    android:paddingRight="12dp" >
<ScrollView 
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_above="@+id/tagVenue"
    android:layout_alignParentTop="true" 
    android:layout_marginBottom="5dp">
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#D0E4F7"
        android:paddingBottom="5dp"
        android:paddingLeft="1dp"
        android:paddingRight="1dp" >
        <TextView
            android:id="@+id/vName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_marginTop="10dp"
            android:text="Fore Street Bar and Grill"
            android:textIsSelectable="true"
            android:textStyle="bold" />
        <TextView
            android:id="@+id/vAddress"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/vName"
            android:layout_marginTop="5dp"
            android:textIsSelectable="true" 
            android:text="105 Congress St. \nPortland, ME 04055"/>
        <TextView
            android:id="@+id/vPhone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/vAddress"
            android:textIsSelectable="true" 
            android:layout_marginTop="5dp"
            android:text="207-555-1111"/>
        <TextView
            android:id="@+id/vWeb"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/vPhone"
            android:textIsSelectable="true" 
            android:layout_marginTop="5dp"
            android:text="www.xyz.com"/>
        <TextView
            android:id="@+id/vDistance"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="false"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/map"
            android:layout_marginRight="5dp"
            android:layout_marginTop="5dp"
            android:text="100 meters away"
            android:textIsSelectable="true" />

        <TextView
            android:id="@+id/vCuisine"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/vWeb"
            android:textIsSelectable="true" 
            android:layout_marginTop="5dp"
            android:text="American, Fusion"/>

        <TextView
            android:id="@+id/vHours"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/vRating"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="3dp"
            android:text="Hours: 10:00 - 22:00 Currently open!"
            android:textIsSelectable="true"
            android:textStyle="bold" />
        <TextView
            android:id="@+id/vRating"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/vCuisine"
            android:textIsSelectable="true" 
            android:text="5 Stars"/>
        <View 
            android:id="@+id/dividing_line"
            android:layout_height="1dp"
            android:layout_width="fill_parent"
            android:background="#000000" 
            android:layout_below="@+id/vHours"
            android:layout_marginTop="5dp"/>

        <!-- SupportMapFragment -->
        <fragment
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="120dip"
            android:layout_height="120dip"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="5dp" />
        <TableLayout
            android:id="@+id/table1"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:layout_below="@+id/dividing_line" 
            android:layout_marginTop="5dp">
            <TableRow
                android:id="@+id/tableRow1a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:weightSum="2">
                <TextView
                    android:id="@+id/vtext"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:layout_weight=".7"
                    android:text="text"
                    android:textIsSelectable="true"
                    android:textSize="18dp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/text2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1.3"
                    android:text="93/100"
                    android:textIsSelectable="true"
                    android:textSize="20dp"
                    android:textStyle="bold" />
            </TableRow>
        </TableLayout>      
        <TableLayout
            android:id="@+id/table2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/table1"
            android:layout_marginTop="5dp" >
            <TableRow
                android:id="@+id/tableRow1b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TextView
                    android:id="@+id/text3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true"
                    android:textStyle="bold" />
            </TableRow>
            <TableRow
                android:id="@+id/tableRow3b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
                <TextView
                    android:id="@+id/text4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
                <TextView
                    android:id="@+id/vTag1Mag"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
            </TableRow>
            <TableRow
                android:id="@+id/tableRow4b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >          
                <TextView
                    android:id="@+id/vtext2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
                <TextView
                    android:id="@+id/vTag2Mag"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
            </TableRow>
            <TableRow
                android:id="@+id/tableRow5b"
                android:layout_width="wrap_content"
                        android:layout_height="wrap_content">   
                            <TextView
                    android:id="@+id/vtext3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
                <TextView
                    android:id="@+id/vTag3Mag"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
            </TableRow>
            <TableRow   
                android:id="@+id/tableRow6b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >      
                <TextView
                    android:id="@+id/vtext4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
                <TextView
                    android:id="@+id/vTag4Mag"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
            </TableRow>
            <TableRow   
                android:id="@+id/tableRow7b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >      
                <TextView
                    android:id="@+id/vtext5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
                <TextView
                    android:id="@+id/vTag5Mag"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
            </TableRow>
            <TableRow   
                android:id="@+id/tableRow8b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >      
                <TextView
                    android:id="@+id/vtext6"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
                <TextView
                    android:id="@+id/vTag6Mag"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="text"
                    android:textIsSelectable="true" />
            </TableRow> 
        </TableLayout>
    </RelativeLayout>
</ScrollView>
<RelativeLayout
    android:id="@+id/textdlfka"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_below="@+id/detailFragment" >
        <EditText
            android:id="@+id/text7"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_toLeftOf="@+id/Button01"
            android:hint="@string/search" >
        </EditText>
        <Button
            android:id="@+id/Button01"
            android:layout_width="wrap_content"
            android:layout_height="40dip"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:text="@string/search" >
        </Button>
</RelativeLayout>
</RelativeLayout>

Answers


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/detailFragment"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#D0E4F7"
    android:paddingBottom="5dp"
    android:paddingLeft="12dp"
    android:paddingRight="12dp" >

    <ScrollView
        android:id="@+id/scrollview"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_above="@+id/textdlfka"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="5dp" >

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#D0E4F7"
            android:paddingBottom="5dp"
            android:paddingLeft="1dp"
            android:paddingRight="1dp" >

            <TextView
                android:id="@+id/vName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_marginTop="10dp"
                android:text="Fore Street Bar and Grill"
                android:textIsSelectable="true"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/vAddress"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/vName"
                android:layout_marginTop="5dp"
                android:text="105 Congress St. \nPortland, ME 04055"
                android:textIsSelectable="true" />

            <TextView
                android:id="@+id/vPhone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/vAddress"
                android:layout_marginTop="5dp"
                android:text="207-555-1111"
                android:textIsSelectable="true" />

            <TextView
                android:id="@+id/vWeb"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/vPhone"
                android:layout_marginTop="5dp"
                android:text="www.xyz.com"
                android:textIsSelectable="true" />

            <TextView
                android:id="@+id/vDistance"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="false"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/map"
                android:layout_marginRight="5dp"
                android:layout_marginTop="5dp"
                android:text="100 meters away"
                android:textIsSelectable="true" />

            <TextView
                android:id="@+id/vCuisine"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/vWeb"
                android:layout_marginTop="5dp"
                android:text="American, Fusion"
                android:textIsSelectable="true" />

            <TextView
                android:id="@+id/vHours"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/vRating"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="3dp"
                android:text="Hours: 10:00 - 22:00 Currently open!"
                android:textIsSelectable="true"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/vRating"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/vCuisine"
                android:text="5 Stars"
                android:textIsSelectable="true" />

            <View
                android:id="@+id/dividing_line"
                android:layout_width="fill_parent"
                android:layout_height="1dp"
                android:layout_below="@+id/vHours"
                android:layout_marginTop="5dp"
                android:background="#000000" />

            <!-- SupportMapFragment -->

            <fragment
                android:id="@+id/map"
                android:name="com.google.android.gms.maps.SupportMapFragment"
                android:layout_width="120dip"
                android:layout_height="120dip"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:layout_marginTop="5dp" />

            <TableLayout
                android:id="@+id/table1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/dividing_line"
                android:layout_marginTop="5dp" >

                <TableRow
                    android:id="@+id/tableRow1a"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <TextView
                        android:id="@+id/vtext"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:layout_weight=".7"
                        android:text="text"
                        android:textIsSelectable="true"
                        android:textSize="18dp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/text2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:layout_weight="1.3"
                        android:text="93/100"
                        android:textIsSelectable="true"
                        android:textSize="20dp"
                        android:textStyle="bold" />
                </TableRow>
            </TableLayout>

            <TableLayout
                android:id="@+id/table2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/table1"
                android:layout_marginTop="5dp" >

                <TableRow
                    android:id="@+id/tableRow1b"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/text3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true"
                        android:textStyle="bold" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow3b"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/text4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />

                    <TextView
                        android:id="@+id/vTag1Mag"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow4b"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/vtext2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />

                    <TextView
                        android:id="@+id/vTag2Mag"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow5b"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/vtext3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />

                    <TextView
                        android:id="@+id/vTag3Mag"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow6b"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/vtext4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />

                    <TextView
                        android:id="@+id/vTag4Mag"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow7b"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/vtext5"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />

                    <TextView
                        android:id="@+id/vTag5Mag"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow8b"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/vtext6"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />

                    <TextView
                        android:id="@+id/vTag6Mag"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="text"
                        android:textIsSelectable="true" />
                </TableRow>
            </TableLayout>
        </RelativeLayout>
    </ScrollView>

    <RelativeLayout
        android:id="@+id/textdlfka"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/scrollview" >

        <EditText
            android:id="@+id/text7"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_toLeftOf="@+id/Button01"
            android:hint="@string/search" >
        </EditText>

        <Button
            android:id="@+id/Button01"
            android:layout_width="wrap_content"
            android:layout_height="40dip"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:text="@string/search" >
        </Button>
    </RelativeLayout>

</RelativeLayout>

Need Your Help

Trying to construct a Bash executable string involving MySQL

mysql linux bash

I am trying to write a Bash script to run a MySQL query from a string constructed in the script. I have been able to construct the query string, and it looks correct when echo'd. And I can cut and ...