xml - Android ignoring weight parameter on custom row -


i have following xml build custom row listview. it's working fine, status next address being word wrapped don't want. in past i've set weight , it's been fine, doesn't seem playing ball here.

here looks like:

enter image description here

heres happens on phone:

enter image description here

heres xml:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/linearlayout1"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:background="@drawable/listviewonclick"     android:orientation="vertical"     android:padding="@dimen/padding" >      <linearlayout         android:id="@+id/linhoz"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_weight="10" >          <textview             android:id="@+id/status"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight="3"             android:paddingleft="@dimen/left"             android:text="large text"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="@color/cachecolor"             android:textsize="@dimen/medtext" />          <textview             android:id="@+id/txtspacer"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:paddingleft="@dimen/left"             android:text=" | "             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="@color/yellow"             android:textsize="@dimen/medtext" />          <textview             android:id="@+id/address"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight="3"             android:paddingleft="@dimen/left"             android:text="large text"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="@color/white"             android:textsize="@dimen/medtext" />      </linearlayout>      <linearlayout         android:id="@+id/linhoz2"         android:layout_width="fill_parent"         android:layout_height="wrap_content" >          <imageview             android:id="@+id/icon"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_gravity="center_vertical"             android:clickable="true"             android:padding="10dp"             android:src="@drawable/ico_information" />          <textview             android:id="@+id/text"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:clickable="true"             android:padding="10dp"             android:layout_weight="6"             android:text="medium text"             android:textappearance="?android:attr/textappearancemedium" />          <button             android:id="@+id/btnstart"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:background="@drawable/greenbuttons"             android:text="start" />      </linearlayout>    <linearlayout       android:id="@+id/linarea"       android:layout_width="fill_parent"       android:layout_height="wrap_content"       android:layout_weight="0.50" >        <button           android:id="@+id/btnmap"           style="?android:attr/buttonstylesmall"           android:layout_width="wrap_content"           android:layout_height="28dp"           android:layout_margin="4dp"           android:layout_weight="3"           android:background="@drawable/smallbluebutton"           android:text="map" />        <button           android:id="@+id/btninformation"           style="?android:attr/buttonstylesmall"           android:layout_width="wrap_content"           android:layout_height="28dp"           android:layout_margin="4dp"           android:layout_weight="3"           android:background="@drawable/smallpurplebuttons"           android:text="information" />        <button           android:id="@+id/btnproblems"           style="?android:attr/buttonstylesmall"           android:layout_width="110dp"           android:layout_height="28dp"           android:layout_margin="4dp"           android:layout_weight="3"           android:background="@drawable/smallredbutton"           android:text="problems" />   </linearlayout>  </linearlayout> 

if there not enough space both textview's show text in single line, either warp or ellipsis. default, textview's multi-line, , wrap text. use ellipsis instead, add android:singleline="true".

about proportioning text width: set android:layout_width="0dp" views participating in weighted layout. assign weights each using android:layout_weight in proportion. e.g. 0.3 download textview , 0.7 address textview. give 30% space first view , 70% of space second view.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -