layout for ListView followed by non-scrolling TextView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

layout for ListView followed by non-scrolling TextView

Postby thebusyant » Thu Dec 03, 2009 6:28 pm

Hi,

I'm having trouble setting up an Android Layout.

What I would like is a scrollable ListView followed by a small bar of text (TextView) that doesn't scroll and always stays at the bottom of the screen.

it would look like this:


Image

I've tried a bunch of different variations on this, but none shows the static text

Any thoughts as to where I'm going wrong?

TKS!



Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.    android:orientation="vertical" android:layout_width="fill_parent"
  4.    android:layout_height="fill_parent">
  5.     <LinearLayout android:orientation="vertical"
  6.        android:layout_width="fill_parent" android:layout_height="wrap_content">
  7.         <ListView android:id="@+id/list2" android:layout_width="fill_parent"
  8.                android:layout_height="fill_parent" />
  9.     </LinearLayout>
  10.     <TextView android:layout_width="fill_parent"
  11.        android:layout_height="50dip" android:text="Bar of text that always stays at the bottom of the screen" />
  12. </LinearLayout>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4
yo
thebusyant
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Dec 03, 2009 6:11 pm
Location: usa! usa! usa!

Top

Postby grzegorz.zajac » Thu Dec 03, 2009 6:55 pm

Here is how I did it in my "GPW Notowania" application (see attachment).
Instead of the TextView I use Button but this does not matter:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout
  4.  
  5.    xmlns:android="http://schemas.android.com/apk/res/android"
  6.  
  7.    android:orientation="vertical"
  8.  
  9.    android:layout_width="fill_parent"
  10.  
  11.    android:layout_height="fill_parent">
  12.  
  13.  
  14.  
  15.     <ListView
  16.  
  17.        style="@style/GPWListViewStyle"
  18.  
  19.        android:id="@android:id/list"
  20.  
  21.        android:layout_width="fill_parent"
  22.  
  23.        android:layout_height="fill_parent"
  24.  
  25.        android:layout_marginBottom="50px" />
  26.  
  27.  
  28.  
  29.     <Button
  30.  
  31.        style="@style/ToggleButtonStyle"
  32.  
  33.        android:id="@+id/toggle_button"
  34.  
  35.        android:text="@string/show_indices"
  36.  
  37.        android:layout_width="fill_parent"
  38.  
  39.        android:layout_height="fill_parent"        
  40.  
  41.        android:layout_marginTop="-50px" />
  42.  
  43. </LinearLayout>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


The trick is to use -50px for Button's top margin.

Regards,
Grzesiek
Attachments
screen_shot_1.png
screen_shot_1.png (30.94 KiB) Viewed 844 times
grzegorz.zajac
Developer
Developer
 
Posts: 39
Joined: Wed Feb 18, 2009 8:37 pm
Location: Krakow/Poland

Postby achie1266 » Sun Dec 06, 2009 7:31 pm

what you want is footer.

here is an example. The long code is just for a form. so neglect that part and see how the footer was implemented.
viewtopic.php?p=15978
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby Zeba Momin » Sat Jan 02, 2010 12:44 pm

thank you so much grzegorz.zajac
your trick has saved me a lot of time..!!!
Thank you :)
Zeba Momin
Developer
Developer
 
Posts: 49
Joined: Thu Sep 17, 2009 6:53 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests