Different alignments on a tablerow Android -


i have custom listview layout xml

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" >   <tablelayout      android:id="@+id/tablelayout1"      android:layout_width="match_parent"      android:layout_height="wrap_content"      android:layout_gravity="center_horizontal" >       <tablerow android:gravity="center" >            <imageview              android:id="@+id/image"              android:layout_width="wrap_content"              android:layout_height="wrap_content"              android:layout_gravity="left"              android:gravity="left"/>           <textview              android:id="@+id/headline"              android:layout_width="fill_parent"              android:layout_height="wrap_content"              android:layout_gravity="center|center_horizontal"              android:gravity="center"/>       </tablerow>  </tablelayout> 

it works fine want imagebutton aligned @ left , textview aligned @ center.

searching lot find using gravity on tablerow can align tablerow content, imageview gravity , textview gravity seems have no effect

that layout make like

[    image text    ] 

i want like

[image   text      ] 

so image aligned left , textview centered, dont want use fixed separation because text dynamically loaded , cant know lenght

can me?

sorry bad english

use xml

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" >   <tablelayout      android:id="@+id/tablelayout1"      android:layout_width="match_parent"      android:layout_height="wrap_content"      android:layout_gravity="center_horizontal" >       <tablerow  >            <imageview              android:id="@+id/image"              android:layout_width="wrap_content"              android:layout_height="wrap_content"              android:layout_gravity="left"              android:gravity="left"              android:src="@drawable/ic_launcher"/>           <textview              android:id="@+id/headline"              android:layout_width="0dp"              android:layout_weight="1"              android:layout_height="wrap_content"              android:layout_gravity="center|center_horizontal"              android:gravity="center"              android:text="text"/>       </tablerow>  </tablelayout>  </linearlayout> 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -