Thursday, May 2, 2013

[android help] 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:




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" >
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_above="@+id/tagVenue"
android:layout_alignParentTop="true"
android:layout_marginBottom="5dp">
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#D0E4F7"
android:paddingBottom="5dp"
android:paddingLeft="1dp"
android:paddingRight="1dp" >
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" />
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"/>
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"/>
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"/>
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" />

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"/>

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" />
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"/>
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"/>


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" />
android:id="@+id/table1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_below="@+id/dividing_line"
android:layout_marginTop="5dp">
android:id="@+id/tableRow1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="2">
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" />

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" />


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

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" />

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

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

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

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

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

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




android:id="@+id/textdlfka"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_below="@+id/detailFragment" >
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" >

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" >





.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...