TextView Under Growing ListView

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

TextView Under Growing ListView

Postby medicalfix » Sun Dec 28, 2008 10:16 pm

Hi, I currently I'm trying to display a TextView on the top and bottom of my screen and in the middle my ListView.

The problem is that when my ListView grows it pushes my bottom TextView out of the screen.
How can I overcome this?
Thanks!
here is current XML:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout xmlns:android=
  4.  
  5. "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. android:background="#000000">
  14.  
  15.         <TextView
  16.  
  17.                 android:id="@+id/loadingStatus"
  18.  
  19.                 android:layout_width="fill_parent"
  20.  
  21.                 android:layout_height="wrap_content"
  22.  
  23.                 android:gravity="center"
  24.  
  25.                 android:text="Title..."
  26.  
  27.                 android:textSize="20sp"
  28.  
  29.         />
  30.  
  31.            
  32.  
  33.         <LinearLayout
  34.  
  35.                 android:id="@+id/LinearLayout01"
  36.  
  37.                 android:layout_width="wrap_content"
  38.  
  39.                 android:layout_height="wrap_content">
  40.  
  41.                
  42.  
  43.         <ListView
  44.  
  45.                 android:id="@+id/android:list"
  46.  
  47.                 android:layout_width="wrap_content"
  48.  
  49.                 android:layout_height="wrap_content"/>
  50.  
  51.                
  52.  
  53.  
  54.  
  55.         </LinearLayout>
  56.  
  57.  
  58.  
  59.         <TextView
  60.  
  61.                 android:id="@+id/streamStatusBar"
  62.  
  63.                 android:layout_width="fill_parent"
  64.  
  65.                 android:text="Processing Some Information"
  66.  
  67.                 android:textSize="12sp"
  68.  
  69.                 android:textColor="#FFFFFF"
  70.  
  71.                 android:layout_gravity="left|center_horizontal"
  72.  
  73.                 android:gravity="center_horizontal"
  74.  
  75.                 android:layout_height="18px"
  76.  
  77.                 android:layout_marginBottom="4px"/>
  78.  
  79. </LinearLayout>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
medicalfix
Junior Developer
Junior Developer
 
Posts: 17
Joined: Sat Nov 01, 2008 9:55 pm

Top

Postby MrSnowflake » Sun Dec 28, 2008 11:04 pm

I have explained this numerous times, but just for this once, I'll repeat:
Use layout_gravity for this, read the docs for more info.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby medicalfix » Mon Dec 29, 2008 4:04 am

Thanks for your reply but I truly don't know what you mean... Do you have a feed link you can give me so that I can check how to do this?

Thanks
medicalfix
Junior Developer
Junior Developer
 
Posts: 17
Joined: Sat Nov 01, 2008 9:55 pm

Postby MrSnowflake » Mon Dec 29, 2008 1:39 pm

Check the docs for Layouts.

Oh and try to search the forums for layout_weight (this is the one you need) I have made a couple of posts about this. Maybe I'll make a tut one day... :).
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby medicalfix » Tue Dec 30, 2008 12:23 am

Well to all those who run into the same problem here is my solution!
Enjoy!

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout xmlns:android=
  4.  
  5. "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. android:background="#000000">
  14.  
  15.      <TextView
  16.  
  17.          android:id="@+id/loadingStatus"
  18.  
  19.          android:layout_width="fill_parent"
  20.  
  21.          android:layout_height="wrap_content"
  22.  
  23.          android:gravity="center"
  24.  
  25.          android:text="Title..."
  26.  
  27.          android:textSize="20sp"
  28.  
  29.     />
  30.  
  31.  
  32.  
  33.     <ListView
  34.  
  35.                 android:id="@+id/android:list"
  36.  
  37.                 android:layout_width="fill_parent"
  38.  
  39.                 android:layout_height="0dip"
  40.  
  41.                 android:layout_weight="1"
  42.  
  43.                 android:drawSelectorOnTop="false"
  44.  
  45.                 android:layout_marginTop="0dip"
  46.  
  47.                 android:layout_marginBottom="0dip"
  48.  
  49.         />
  50.  
  51.  
  52.  
  53.      <TextView
  54.  
  55.          android:id="@+id/streamStatusBar"
  56.  
  57.          android:layout_width="fill_parent"
  58.  
  59.          android:text="Processing Some Information"
  60.  
  61.          android:textSize="12sp"
  62.  
  63.          android:textColor="#FFFFFF"
  64.  
  65.          android:layout_gravity="left|center_horizontal"
  66.  
  67.          android:gravity="center_horizontal"
  68.  
  69.          android:layout_height="wrap_content" android:layout_marginBottom="0px"/>
  70.  
  71. </LinearLayout>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
medicalfix
Junior Developer
Junior Developer
 
Posts: 17
Joined: Sat Nov 01, 2008 9:55 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 6 guests