ListView row and Alignement

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

ListView row and Alignement

Postby Stam » Mon Dec 07, 2009 10:11 pm

Hi all,

I try to do an alignement in a row, but It doesn't work.

It work out of the row (in a simple linear) but not in !

Here is my code :

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.  
  4.                 android:orientation="horizontal"
  5.  
  6.             android:layout_width="fill_parent"
  7.  
  8.         android:layout_height="fill_parent"
  9.  
  10.         >
  11.  
  12.     <ImageView android:id="@+id/castleupgrade_img_upgrade" xmlns:android="http://schemas.android.com/apk/res/android"
  13.  
  14.             android:src="@drawable/btn_vierge"
  15.  
  16.             android:layout_width="wrap_content"
  17.  
  18.             android:layout_height="wrap_content"
  19.  
  20.             android:layout_gravity="left"/>
  21.  
  22.         <TextView android:id="@+id/castleupgrade_lbl_upgrade" xmlns:android="http://schemas.android.com/apk/res/android"
  23.  
  24.             android:layout_width="wrap_content"
  25.  
  26.             android:layout_height="wrap_content"/>
  27.  
  28.         <ImageView android:id="@+id/castleupgrade_img_upgrade" xmlns:android="http://schemas.android.com/apk/res/android"
  29.  
  30.             android:src="@drawable/btn_add"
  31.  
  32.             android:layout_width="wrap_content"
  33.  
  34.             android:layout_height="wrap_content"
  35.  
  36.             android:layout_gravity="right"/>
  37.  
  38. </LinearLayout>
  39.  
  40.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


I try to make something like that
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. ---------------------------------------------------------
  3.  
  4. |Button SomeText                                  Button|
  5.  
  6. ---------------------------------------------------------
  7.  
  8.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


Someone can help me ?
Stam
Junior Developer
Junior Developer
 
Posts: 22
Joined: Wed Nov 25, 2009 1:49 pm
Location: Lille, France

Top

Postby qlimax » Tue Dec 08, 2009 12:42 am

hi stam,

this solution uses a relativelayout but should be OK for your goal.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <RelativeLayout
  2.  
  3. android:id="@+id/RelativeLayout01"
  4.  
  5. android:layout_width="fill_parent"
  6.  
  7. android:layout_height="wrap_content"
  8.  
  9. xmlns:android="http://schemas.android.com/apk/res/android">
  10.  
  11.  
  12.  
  13.  
  14.  
  15.         <ImageView
  16.  
  17.         android:id="@+id/ImageView01"
  18.  
  19.         android:src="@drawable/def"
  20.  
  21.         android:layout_width="wrap_content"
  22.  
  23.         android:layout_height="wrap_content">
  24.  
  25.         </ImageView>
  26.  
  27.  
  28.  
  29.         <TextView
  30.  
  31.         android:layout_toRightOf="@id/ImageView01"
  32.  
  33.         android:layout_centerVertical="true"
  34.  
  35.         android:text="QWERTZ"
  36.  
  37.         android:id="@+id/TextView01"
  38.  
  39.         android:layout_width="wrap_content"
  40.  
  41.    android:layout_height="wrap_content">
  42.  
  43.     </TextView>
  44.  
  45.  
  46.  
  47.         <ImageView     
  48.  
  49.         android:layout_alignParentRight="true"
  50.  
  51.         android:id="@+id/ImageView02"
  52.  
  53.         android:src="@drawable/def"
  54.  
  55.    android:layout_width="wrap_content"
  56.  
  57.         android:layout_height="wrap_content">
  58.  
  59.         </ImageView>
  60.  
  61.  
  62.  
  63. </RelativeLayout>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


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

Postby Stam » Tue Dec 08, 2009 8:42 am

Yeah, it's better !

Thanks you a lot !
Stam
Junior Developer
Junior Developer
 
Posts: 22
Joined: Wed Nov 25, 2009 1:49 pm
Location: Lille, France

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot], Google Feedfetcher and 8 guests