java - Android: Make TableRow independet of TableLayout -
here's issue, have tablelayout
has multiple tablerows
.
i want them in table making right alignment, wanted 1 of tablerow's
inside tablelayout
independent of of sizes , independent , textview
inside centered.
this code:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" 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="com.example.catarinaferreira.tripmanager.reservation_payment"> <!-- todo: update blank fragment layout --> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <linearlayout android:id="@+id/layout_title_total" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="right" android:background="?attr/colorcontrolhighlight" android:gravity="right" android:orientation="horizontal"> <textview android:id="@+id/textview15" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:background="@color/laranja_logo" android:text="pagamento" android:textcolor="@color/white" android:textsize="26dp" android:textstyle="normal|bold" /> </linearlayout> <space android:layout_width="match_parent" android:layout_height="10dp" /> <textview android:id="@+id/textview26" android:layout_width="match_parent" android:layout_height="wrap_content" android:fontfamily="casual" android:text="resumo reserva" android:textcolor="@android:color/black" android:textsize="24sp" android:textstyle="bold" /> <linearlayout android:layout_width="match_parent" android:layout_height="5dp" android:background="@android:color/black" android:orientation="vertical"></linearlayout> <space android:layout_width="match_parent" android:layout_height="5dp" /> <linearlayout android:id="@+id/total_going_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <tablelayout android:id="@+id/total_going_table" android:layout_width="match_parent" android:layout_height="wrap_content" android:divider="@android:color/darker_gray" android:showdividers="middle"> <tablerow android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#f1f1f1" android:paddingbottom="10dp" android:paddingtop="5dp"> <textview android:id="@+id/textview28" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginright="10dp" android:text="qtd" android:textcolor="@android:color/black" android:textsize="18sp" android:textstyle="bold" /> <textview android:id="@+id/textview29" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginright="15dp" android:fontfamily="sans-serif" android:text="descrição" android:textcolor="@android:color/black" android:textsize="18sp" android:textstyle="bold" /> <textview android:id="@+id/textview30" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginright="10dp" android:text="preço(€)" android:textcolor="@android:color/black" android:textsize="18sp" android:textstyle="bold" /> <textview android:id="@+id/textview31" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginright="10dp" android:text="total(€)" android:textcolor="@android:color/black" android:textsize="18sp" android:textstyle="bold" /> </tablerow> <tablerow android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_light" android:gravity="center"> <textview android:id="@+id/textview32" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="ida" android:textalignment="textstart" android:textallcaps="false" android:textcolor="@android:color/white" android:textsize="18sp" android:textstyle="bold" /> </tablerow> <tablerow android:layout_width="match_parent" android:layout_height="match_parent" > <textview android:id="@+id/textview35" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1" android:textcolor="@android:color/black" android:textsize="18sp" /> <textview android:id="@+id/textview41" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="adulto" android:textcolor="@android:color/black" android:textsize="18sp" /> <textview android:id="@+id/textview42" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="20€" android:textcolor="@android:color/black" android:textsize="18sp" /> <textview android:id="@+id/textview43" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="20€" android:textcolor="@android:color/black" android:textsize="18sp" /> </tablerow> </tablelayout> </linearlayout> </linearlayout>
then show images of problem. want textview
in tablerow
blue backgound centered this:
but if textview
has more characters, "qtd" column affected big space:
how can size of textview
text doesn't affect first column?
thanks help!!
try change tablerow this:
<tablerow android:layout_width="match_parent" android:layout_height="wrap_content" android:weightsum="1" android:background="@android:color/holo_blue_light"> <textview android:id="@+id/textview32" android:layout_width="0dp" android:layout_height="wrap_content" android:text="regresso" android:layout_weight="1" android:gravity="center" android:textallcaps="false" android:textcolor="@android:color/white" android:textsize="18sp" android:textstyle="bold" /> </tablerow>
Comments
Post a Comment