Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make one part of view (relativelayout) scroll, but another part not move?
    primarykey
    data
    text
    <p>I have a <code>RelativeLayout</code> that is a detail page for search results. It displays a bunch of different <code>TextViews</code>, has a table or two, and also holds a <code>SupportMapFragment</code>. I want that portion to be scrollable. I also have a <code>LinearLayout</code> that holds an <code>EditText</code> and a <code>Button</code> 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. </p> <p>I tried to wrap the layout I want scrolling in a <code>ScrollView</code>, leave the other layout out of that, and then wrap the whole thing in a <code>RelativeLayout</code>. 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. </p> <p>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?</p> <p>The layout file I'm wrangling is here:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" &gt; &lt;ScrollView android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_above="@+id/tagVenue" android:layout_alignParentTop="true" android:layout_marginBottom="5dp"&gt; &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#D0E4F7" android:paddingBottom="5dp" android:paddingLeft="1dp" android:paddingRight="1dp" &gt; &lt;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" /&gt; &lt;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"/&gt; &lt;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"/&gt; &lt;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"/&gt; &lt;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" /&gt; &lt;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"/&gt; &lt;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" /&gt; &lt;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"/&gt; &lt;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"/&gt; &lt;!-- SupportMapFragment --&gt; &lt;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" /&gt; &lt;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"&gt; &lt;TableRow android:id="@+id/tableRow1a" android:layout_width="wrap_content" android:layout_height="wrap_content" android:weightSum="2"&gt; &lt;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" /&gt; &lt;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" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;TableLayout android:id="@+id/table2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/table1" android:layout_marginTop="5dp" &gt; &lt;TableRow android:id="@+id/tableRow1b" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;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" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow3b" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;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" /&gt; &lt;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" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow4b" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;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" /&gt; &lt;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" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow5b" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;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" /&gt; &lt;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" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow6b" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;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" /&gt; &lt;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" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow7b" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;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" /&gt; &lt;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" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow8b" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;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" /&gt; &lt;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" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/RelativeLayout&gt; &lt;/ScrollView&gt; &lt;RelativeLayout android:id="@+id/textdlfka" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/detailFragment" &gt; &lt;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" &gt; &lt;/EditText&gt; &lt;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" &gt; &lt;/Button&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload