Problem with layout_width/weight in a single listview item

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

Problem with layout_width/weight in a single listview item

Postby YoFrankie » Wed Jan 06, 2010 12:25 am

Hello,

have some trouble with my listview.
The x-position of the second textview shall be the same in every listviewitem, independent of its content. I tried fill_parent and layout_weight:1 for both textviews, but it didn't help.

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.  
  8.  
  9. android:layout_width="fill_parent" android:layout_height="wrap_content"
  10.  
  11.  
  12.  
  13. android:orientation="horizontal">
  14.  
  15.  
  16.  
  17. <ImageView android:id="@+id/icon" android:layout_width="25px"
  18.  
  19.  
  20.  
  21. android:layout_height="25px" />
  22.  
  23.  
  24.  
  25. <TextView android:id="@+id/name" android:layout_width="wrap_content"
  26.  
  27.  
  28.  
  29. android:layout_height="wrap_content" android:layout_weight="1" />
  30.  
  31.  
  32.  
  33. <TextView android:id="@+id/secondname" android:layout_width="wrap_content"
  34.  
  35.  
  36.  
  37. android:layout_height="wrap_content" android:layout_weight="1" />
  38.  
  39.  
  40.  
  41.  
  42.  
  43. </LinearLayout>
  44.  
  45.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4
YoFrankie
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Aug 03, 2009 4:52 pm

Top

Postby qlimax » Wed Jan 06, 2010 1:08 am

try to modify with layout width ="0"
or give fixed with to the tv

wrap content actually will enlarge your tv as needed

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

Postby YoFrankie » Wed Jan 06, 2010 3:50 am

nice workaround, works perfectly
is the another way to do something like that?
YoFrankie
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Aug 03, 2009 4:52 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests