android - Use Linear Layout in TableRow -
i try make table in android app cells this:
(sorry link, can't attach images due low reputation)
my idea use linear layout in table row, not working correct. please, if have idea how modify table layout work expect - give me idea.
my xml code
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:background="@color/black" android:orientation="vertical" > <tablelayout style="@style/textcolor" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="90" android:stretchcolumns="1" android:textcolor="@colors/white" > <tablerow> <textview style="@style/textcolor" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/cell" android:gravity="center" android:padding="10dip" android:singleline="false" android:text="@string/start_time" /> <textview style="@style/textcolor" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/cell" android:gravity="center" android:padding="10dip" android:text="@string/start_time" /> </tablerow> <tablerow android:id="@+id/tablerow2" android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview style="@style/textcolor" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/cell" android:gravity="center" android:padding="10dip" android:text="@string/start_time" /> <textview style="@style/textcolor" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/cell" android:gravity="center" android:padding="10dip" android:text="@string/start_time" /> </tablerow> <tablerow android:id="@+id/tablerow3" android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview style="@style/textcolor" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/cell" android:gravity="center" android:padding="10dip" android:text="@string/start_time" /> <textview style="@style/textcolor" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/cell" android:gravity="center" android:padding="10dip" android:text="@string/start_time" /> </tablerow> <tablerow android:id="@+id/tablerow4" android:layout_width="wrap_content" android:layout_height="wrap_content" > </tablerow> <tablerow android:id="@+id/tablerow1" android:layout_width="wrap_content" android:layout_height="wrap_content" > </tablerow> </tablelayout> <textview android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="10" android:gravity="center" android:text="adds" /> </linearlayout>
edit made changes according comments. please, take , tell me please, why text not displayed?
<linearlayout xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:background="@color/black" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/black" android:orientation="horizontal" android:baselinealigned="false" > <linearlayout android:layout_weight=".5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/cell" android:orientation="vertical" > <textview android:layout_height="fill_parent" style="@style/textcolor" android:gravity="center" android:padding="10dip" android:text="@string/start_time" /> <textview style="@style/textcolor" android:gravity="center" android:padding="10dip" android:text="@string/activate" /> </linearlayout> <linearlayout android:layout_weight=".5" android:layout_width="0dip" android:layout_height="wrap_content" android:background="@drawable/cell" android:orientation="vertical" > <textview android:layout_height="fill_parent" style="@style/textcolor" android:gravity="center" android:padding="10dip" android:text="@string/start_time" /> <textview style="@style/textcolor" android:gravity="center" android:padding="10dip" android:text="@string/activate" /> </linearlayout> </linearlayout>
thank help. got solution purpose. xml file looks now:
<linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/black" android:orientation="horizontal" android:baselinealigned="false" > <linearlayout android:layout_weight=".5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/cell" android:orientation="vertical" > <textview style="@style/textcolor" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:padding="10dip" android:textsize="46sp" android:text="@string/start_time" /> <textview style="@style/textcolor" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:padding="10dip" android:paddingbottom="@dimen/zero" android:text="@string/activate" /> </linearlayout> <linearlayout android:layout_weight=".5" android:layout_width="0dip" android:layout_height="wrap_content" android:background="@drawable/cell" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" style="@style/textcolor" android:gravity="center" android:padding="10dip" android:textsize="46sp" android:text="@string/start_time" /> <textview android:layout_width="fill_parent" android:layout_height="fill_parent" style="@style/textcolor" android:gravity="center" android:padding="10dip" android:text="@string/activate" /> </linearlayout>
Comments
Post a Comment