How do you change widths of columns in Android XML?

titchpitch

New Member
I have searched this and have not been able to find an answer that works for me. I currently have 2 columns on my 5th tab. I would like to make the 1st column 40% and the 2nd column 60% in width.I tried using android:layout_weight and setting 1 object in column 1 equal to 0.4 and the other on column to equal to 0.6, but to no avail. Any ideas?\[code\]<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>\[/code\]
 
Back
Top