TextView and ListView layout

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

TextView and ListView layout

Postby Re-Li70 » Mon Nov 30, 2009 4:54 pm

Hi everybody,
I'm looking for a way to have a text and a list in the same view, such as in the image below (in the first image, the default view, in the second the view after some scrolling):

Image

Image

I already have the Orange part (the list), what I'm missing is the green one.
This is what I have at the moment, just the ListvView inside a LinearLayout

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3.  
  4.  
  5. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  6.  
  7.         android:orientation="vertical"
  8.  
  9.         android:layout_width="wrap_content"
  10.  
  11.         android:layout_height="wrap_content">
  12.  
  13.  
  14.  
  15. <ListView android:id="@+id/list"
  16.  
  17.         android:layout_width="wrap_content"
  18.  
  19.         android:layout_height="wrap_content"/>
  20.  
  21.  
  22.  
  23.        
  24.  
  25. </LinearLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


I've tried using a Tab view with just a tab, but the result looks really ugly. I also tried using a simple TextView, but the textview doesn't show up.
Re-Li70
Freshman
Freshman
 
Posts: 3
Joined: Mon Nov 30, 2009 4:00 pm

Top

Postby wiederke » Tue Dec 01, 2009 2:08 pm

Hi,

try this:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2.  
  3.  
  4. <LinearLayout
  5.  
  6.  xmlns:android="http://schemas.android.com/apk/res/android"
  7.  
  8.  android:orientation="vertical"
  9.  
  10.  android:layout_width="fill_parent"
  11.  
  12.  android:layout_height="fill_parent"
  13.  
  14. >
  15.  
  16.  
  17.  
  18.         <TextView
  19.  
  20.           android:layout_width="wrap_content"
  21.  
  22.           android:layout_height="wrap_content"
  23.  
  24.         />
  25.  
  26.  
  27.  
  28.         <ScrollView
  29.  
  30.           android:layout_width="fill_parent"
  31.  
  32.           android:layout_height="fill_parent"
  33.  
  34.  >
  35.  
  36.         <ListView
  37.  
  38.           android:id="@+id/list"
  39.  
  40.           android:layout_width="fill_parent"
  41.  
  42.           android:layout_height="fill_parent"
  43.  
  44.         />
  45.  
  46.   >
  47.  
  48.  
  49.  
  50. </LinearLayout>
  51.  
  52.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4



Torsten
wiederke
Experienced Developer
Experienced Developer
 
Posts: 72
Joined: Mon Mar 02, 2009 6:46 pm
Location: Germany

Postby qlimax » Tue Dec 01, 2009 4:53 pm

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:layout_width="fill_parent"
  8.  
  9.  android:layout_height="fill_parent"
  10.  
  11.  android:orientation="vertical">
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. <LinearLayout
  26.  
  27. android:id="@+id/LinearLayout01"
  28.  
  29. android:layout_width="fill_parent"
  30.  
  31. android:layout_height="wrap_content"
  32.  
  33. android:orientation="vertical"
  34.  
  35. android:gravity="center"
  36.  
  37. android:background="#80C31C"
  38.  
  39. >
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. <TextView
  50.  
  51. android:textColor="#000000"
  52.  
  53. android:text="First Text"
  54.  
  55. android:id="@+id/TextView01"
  56.  
  57. android:layout_width="wrap_content"
  58.  
  59. android:layout_height="wrap_content"
  60.  
  61. android:textSize="30dip">
  62.  
  63. </TextView>
  64.  
  65.  
  66.  
  67.  
  68.  
  69. <TextView
  70.  
  71. android:textColor="#000000"
  72.  
  73. android:text="Second text"
  74.  
  75. android:id="@+id/TextView02"
  76.  
  77. android:layout_width="wrap_content"
  78.  
  79. android:layout_height="wrap_content"
  80.  
  81. >
  82.  
  83.  
  84.  
  85. </TextView>
  86.  
  87. </LinearLayout>
  88.  
  89.  
  90.  
  91. <ListView
  92.  
  93. android:background="#FF7900"
  94.  
  95. android:id="@+id/list"
  96.  
  97. android:layout_width="fill_parent"
  98.  
  99. android:layout_height="fill_parent"/>
  100.  
  101.  
  102.  
  103.  
  104.  
  105. </LinearLayout>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


bye :wink:
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby Re-Li70 » Wed Dec 02, 2009 1:39 am

Thanks to both of you for the answer :)

I used the second proposed layout, and it worked fine (I laughed loud when I saw that even the colors were like my image :lol: )

Thank you!
Re-Li70
Freshman
Freshman
 
Posts: 3
Joined: Mon Nov 30, 2009 4:00 pm

Postby qlimax » Wed Dec 02, 2009 12:29 pm

:xmas: it's a christmas gift :xmas:
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests