android - How to position two TextViews in a ListView next to each other, but having at least a certain gap -
android - How to position two TextViews in a ListView next to each other, but having at least a certain gap -
i want have 2 of textviews position next each other, having @ to the lowest degree space between them. because textviews part of listview, receiving info differs sometimes. want achive first textview, if contains shorter text preceding one, same padding next textview.
here ma layout file:
layoutfile.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/balken_clear" > <textview android:id="@+id/line_color" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignparentleft="true" android:paddingtop="12dp" android:background="#15aba4" android:paddingright="10dp" /> <textview android:id="@+id/realtime_line" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_torightof="@id/line_color" android:paddingleft="10dp" android:paddingright="10dp" android:textcolor="#00003d" android:textsize="22sp" /> <textview android:id="@+id/realtime_direction" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_torightof="@id/realtime_line" android:paddingleft="10dp" android:paddingright="10dp" android:textcolor="#00003d" android:textsize="22sp" /> <textview android:id="@+id/realtime_arrivaltime" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignparentright="true" android:paddingleft="10dp" android:paddingright="16dp" android:textcolor="#00003d" android:textsize="22sp" /> </relativelayout>
and here show illustration looks like
what see is, entry number 140 has bigger gap right textview. there can have other entries same gap?
thank your help!
better give fixed width realtime_line ...so every time occupies same space instead of is.....give space maximum value can inserted in that
example:
140 3 digit if 3 digit max u can prepare 60 dp width...
<textview android:id="@+id/realtime_line" android:layout_width="60dp" android:layout_height="match_parent" android:layout_torightof="@id/line_color" android:paddingleft="10dp" android:paddingright="10dp" android:textcolor="#00003d" android:textsize="22sp" /> <textview android:id="@+id/realtime_direction" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_torightof="@id/realtime_line" android:paddingleft="10dp" android:paddingright="10dp" android:textcolor="#00003d" android:textsize="22sp" />
android listview layout android-listview textview
Comments
Post a Comment