android - Center one Column in a Tablelayout and align the other to the right and left -


i started android programming , have hard time making layouts. want make following tablelayout , want have middle textview (textview3) centered horizontally of page , other 2 textviews should left , right of centered column. if 1 of values in left or right textview generates line break other 2 textviews should centered vertically.

i hope understands problem. greetz

    <tablerow         android:id="@+id/tablerow1"         android:layout_width="wrap_content"         android:layout_height="wrap_content" >          <textview             android:id="@+id/textview2"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="small text"             android:textappearance="?android:attr/textappearancesmall" />          <textview             android:id="@+id/textview3"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="small text"             android:textappearance="?android:attr/textappearancesmall" />          <textview             android:id="@+id/textview4"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="small text"             android:textappearance="?android:attr/textappearancesmall" />      </tablerow> 

okay, after more research got working setting android:layout_width="0dip" each textview. problem was, android:layout_weight depends on actual width of textviews, "wrap_content" not working.

<tablerow     android:id="@+id/tablerow1"     android:layout_width="match_parent"     android:layout_height="wrap_content" >      <textview         android:id="@+id/textview2"         android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="1"         android:gravity="left"         android:text="small text"         android:textappearance="?android:attr/textappearancesmall" />      <textview         android:id="@+id/textview3"         android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="1"         android:gravity="center"         android:text="small text"         android:textappearance="?android:attr/textappearancesmall" />      <textview         android:id="@+id/textview4"         android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="1"         android:gravity="left"         android:text="small text"         android:textappearance="?android:attr/textappearancesmall" /> </tablerow> 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -