How do you change widths of columns in Android XML? -


i have searched , have not been able find answer works me. have 2 columns on 5th tab. make 1st column 40% , 2nd column 60% in width.

i tried using android:layout_weight , setting 1 object in column 1 equal 0.4 , other on column equal 0.6, no avail. ideas?

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:orientation="vertical"     android:layout_width="fill_parent"     android:layout_height="fill_parent">      <tabhost         android:id="@+id/tabhost"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_weight="1" >          <linearlayout             android:layout_width="match_parent"             android:layout_height="match_parent"             android:orientation="vertical" >              <tabwidget                 android:id="@android:id/tabs"                 android:layout_width="match_parent"                 android:layout_height="wrap_content" >             </tabwidget>              <framelayout                 android:id="@android:id/tabcontent"                 android:layout_width="match_parent"                 android:layout_height="match_parent" >                  <linearlayout                     android:id="@+id/tab1"                     android:layout_width="match_parent"                     android:layout_height="match_parent" >                      <button android:text="start"                             android:id="@+id/btn_startwatch"                             android:layout_width="wrap_content"                             android:layout_height="wrap_content"/>                      <button android:text="stop"                             android:id="@+id/btn_stopwatch"                             android:layout_width="wrap_content"                             android:layout_height="wrap_content"/>                      <textview android:text="textview"                               android:id="@+id/tv_showresults"                               android:layout_width="wrap_content"                               android:layout_height="wrap_content"/>                 </linearlayout>                  <linearlayout                     android:id="@+id/tab2"                     android:layout_width="match_parent"                     android:layout_height="match_parent" >                      <textview android:text="textview2"                               android:id="@+id/textview2"                               android:layout_width="wrap_content"                               android:layout_height="wrap_content"/>                 </linearlayout>                  <linearlayout                     android:id="@+id/tab3"                     android:layout_width="match_parent"                     android:layout_height="match_parent" >                      <textview android:text="textview3"                               android:id="@+id/textview3"                               android:layout_width="wrap_content"                               android:layout_height="wrap_content"/>                 </linearlayout>                  <linearlayout                     android:id="@+id/tab4"                     android:layout_width="match_parent"                     android:layout_height="match_parent" >                 </linearlayout>                   <linearlayout                     android:id="@+id/tab5"                     android:layout_width="match_parent"                     android:layout_height="match_parent" >                      <tablelayout android:id="@+id/details"                         android:layout_width="fill_parent"                         android:layout_height="wrap_content"                         android:stretchcolumns="1"                         android:paddingtop="4dp">                         <tablerow>                             <textview android:text="name:" />                             <edittext                                 android:id="@+id/txtresname"                                 android:layout_width="wrap_content"                                 android:layout_height="wrap_content"                                 android:ems="10"                                 android:inputtype="textpersonname" >                                 <requestfocus />                             </edittext>                         </tablerow>                          <tablerow>                             <textview android:text="type:" />                             <radiogroup android:id="@+id/types">                                 <radiobutton android:id="@+id/chctype1"                                     android:text="type 1"/>                                 <radiobutton android:id="@+id/chctype2"                                     android:text="type 2"/>                             </radiogroup>                              <textview android:text="date:" />                             <edittext                                 android:id="@+id/txtresdate"                                 android:layout_width="wrap_content"                                 android:layout_height="wrap_content"                                 android:ems="10"                                 android:inputtype="date" />                         </tablerow>                          <tablerow>                             <textview android:text="time:" />                             <edittext                                 android:id="@+id/txtrestime"                                 android:layout_width="wrap_content"                                 android:layout_height="wrap_content"                                 android:ems="10"                                 android:inputtype="time" />                              <textview android:text="test" />                             <edittext                                 android:id="@+id/txtresnumber"                                 android:layout_width="wrap_content"                                 android:layout_height="wrap_content"                                 android:ems="10"                                 android:inputtype="number" />                         </tablerow>                          <tablerow>                             <textview android:text="test 2" />                             <edittext                                 android:id="@+id/txtrestest2"                                 android:layout_width="wrap_content"                                 android:layout_height="wrap_content"                                 android:ems="10"                                 android:inputtype="phone" />                              <textview android:text="notes:" />                             <edittext                                 android:id="@+id/txtresnotes"                                 android:layout_width="wrap_content"                                 android:layout_height="wrap_content"                                 android:lines="2"                                 android:maxlines="2"                                 android:ems="10"                                 android:maxwidth="200sp"                                 android:inputtype="textmultiline" />                         </tablerow>                     </tablelayout>                 </linearlayout>             </framelayout>         </linearlayout>     </tabhost> </linearlayout> 

you need specify layout_width attribute "0px". layout_weight attribute dictate actual width.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -