android - text view bounding box overly sized in table row -
this scroll view contains table layout. when place text view inside table row, default bounding box of text view consumes available width. result when try placing other views inside same table row, placed outside layout. in images below, first row contains 2 textviews , 2 edittexts can see, 3 of views placed outside due 1st text view. help?
<scrollview xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview1" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <tablelayout android:layout_width="match_parent" android:layout_height="wrap_content"> <tablerow android:id="@+id/tablerow1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="@dimen/activity_horizontal_margin"> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/current_bill_text_view" /> <edittext android:id="@+id/currentbilledittext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" android:inputtype="numberdecimal" > <requestfocus /> </edittext> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/tip_text_view" /> <edittext android:id="@+id/tipedittext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" /> </tablerow> <tablerow android:id="@+id/tablerow2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="@dimen/activity_horizontal_margin" android:padding="@dimen/table_row_padding" > <seekbar android:id="@+id/tipseekbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/total_bill_text_view" /> <edittext android:id="@+id/totalbilledittext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="4" /> </tablerow> <tablerow android:id="@+id/tablerow3" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="@dimen/table_row_padding" > <textview android:id="@+id/textview4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/introduction_text_view" android:textsize="@dimen/activity_horizontal_margin" /> </tablerow> <tablerow android:id="@+id/tablerow4" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="@dimen/activity_horizontal_margin" android:padding="@dimen/table_row_padding" > <checkbox android:id="@+id/checkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/friendly" /> <checkbox android:id="@+id/checkbox2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/opinion" /> <checkbox android:id="@+id/checkbox3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/specials" /> </tablerow> <tablerow android:id="@+id/tablerow5" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="@dimen/table_row_padding" > <textview android:id="@+id/textview5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/availability_text_view" android:textsize="@dimen/activity_horizontal_margin" /> </tablerow> <tablerow android:id="@+id/tablerow6" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="@dimen/activity_horizontal_margin" android:padding="@dimen/table_row_padding" > <radiogroup android:id="@+id/radiogroup1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <radiobutton android:id="@+id/radio0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="@string/good" /> <radiobutton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/ok" /> <radiobutton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/bad" /> </radiogroup> </tablerow> <tablerow android:id="@+id/tablerow7" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="@dimen/table_row_padding" > <spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:entries="@array/problem_solving" /> </tablerow> </tablelayout> </scrollview>
try setting weight each item, this
<button android:id="@+id/punchin" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="0.50" android:text="punch in" /> <button android:id="@+id/punchout" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="0.50" android:text="punch out" />
this 2 items 3 use
android:layout_weight="0.33"
and on...
Comments
Post a Comment