Centering two rows beneath one another in android

GladisDesan

New Member
So I have the following problem, I want to center my two rows beneath one another (horizontally and vertically). But no matter what I try, I cannot get it to work. The best I have gotten is that the first row is centered but the bottom one is all squished to one side, code and what it looks like provided.\[code\]<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:background="#F5F5F5" android:id="@+id/activityRootContainer"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/top_control_bar"> <TextView android:id="@+id/header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Please generate a clocking \n" android:textColor="#000000" android:textSize="18sp" android:textStyle="bold" android:background="#d82929"/> </RelativeLayout> <LinearLayout android:id="@+id/bottom_control_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="#413d3d"> <Button android:id="@+id/back_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Back" /> <Button android:id="@+id/search_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Search" /> </LinearLayout> <ScrollView android:id="@+id/scrllvwNo1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/top_control_bar" android:layout_above="@id/bottom_control_bar" > <RelativeLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:textColor="#000000" android:textStyle="bold" android:textSize="22px" android:layout_centerHorizontal="true"/> <TextView android:id="@+id/numberview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Badge Number:" android:textColor="#000000" android:textStyle="bold" android:layout_below="@id/clock"/> <EditText android:id="@+id/edittext1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/numberview"/> <Button android:id="@+id/button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Clock" android:textColor="#000000" android:textStyle="bold" android:layout_below="@id/edittext1"/> <HorizontalScrollView android:id="@+id/horz" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/button"> <TableLayout android:id="@+id/maintable" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/horz"> <TableRow android:id="@+id/row4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/maintable"> <TextView android:id="@+id/textview2" android:text="" android:padding="0dip" android:textSize="0dip" android:layout_width="0dip" android:layout_height="0dip" android:layout_centerHorizontal="true"/> <TextView android:background="@drawable/cell_shape_header" android:padding="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="Last Badge Number" android:textStyle="bold" android:textColor="#000000" android:layout_toLeftOf="@id/textview2"/> <TextView android:background="@drawable/cell_shape_header" android:padding="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="Current Clock State" android:textStyle="bold" android:textColor="#000000" android:layout_toRightOf="@id/textview2"/> </TableRow> <TableRow android:id="@+id/row5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/row4"> <TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/badgeNo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="Last Badge Number" android:textColor="#000000" android:layout_toLeftOf="@id/textview2"/> <TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/currentState" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="Current Clock State" android:textColor="#000000" android:layout_toRightOf="@id/textview2"/> </TableRow> </TableLayout> </HorizontalScrollView> </RelativeLayout> </ScrollView></RelativeLayout>\[/code\]And my image
androids.jpg
 
Back
Top