Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Why layout is not working exacly as I want? Layout showing two rows and I don't know why.

serasmserasm PLMember ✭✭
edited November 2017 in Xamarin.Android

Hi, I have a problem with axml/layout in Xamarin Android app. I don't know why there are two rows showing.:

And below is result of adding values:

Below is my AXML file with layout.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/main" android:orientation="vertical"> <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tableRowHeader" android:background="@android:color/holo_orange_light"> <TextView android:id="@+id/column1Header" /> <TextView android:id="@+id/column2Header" /> <TextView android:id="@+id/column3Header" /> <TextView android:id="@+id/column4Header" /> <TextView android:id="@+id/column5Header" /> <TextView android:id="@+id/column6Header" /> <TextView android:id="@+id/column7Header" /> <TextView android:id="@+id/column8Header" /> </TableRow> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/scrollView"> <TableLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tableLayoutInScrollView" /> </ScrollView> <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tableRowFooter" android:background="@android:color/holo_red_light"> <TextView android:id="@+id/column1Footer" /> <TextView android:id="@+id/column2Footer" /> <TextView android:id="@+id/column3Footer" /> <TextView android:id="@+id/column4Footer" /> <TextView android:id="@+id/column5Footer" /> <TextView android:id="@+id/column6Footer" /> <TextView android:id="@+id/column7Footer" /> <TextView android:id="@+id/column8Footer" /> </TableRow> </LinearLayout>

I don't know why this is happening, because I was using really close looking layout and everything is working.
AXML is below:

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <TableLayout android:weightSum="0.83" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="left" android:id="@+id/leftTableLayout" android:layout_alignParentRight="false" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_alignParentEnd="true"> <TableRow android:id="@+id/FirstRow" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentRight="false" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_alignParentEnd="false"> <TextView android:id="@+id/route" android:textColor="@android:color/white" android:gravity="center" /> <TextView android:id="@+id/dayTime" android:textColor="@android:color/white" android:gravity="center" /> <TextView android:id="@+id/taken" android:textColor="@android:color/white" android:gravity="center" /> <TextView android:id="@+id/issued" android:textColor="@android:color/white" android:gravity="center" /> <TextView android:id="@+id/checkedBox" android:textColor="@android:color/white" android:gravity="center" /> <TextView android:id="@+id/box" android:textColor="@android:color/white" android:gravity="center" /> </TableRow> <ScrollView android:layout_width="match_parent" android:id="@+id/leftScrollView" android:visibility="visible" android:layout_toEndOf="@id/FirstRow" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentLeft="true"> <TableLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:id="@+id/tableLayoutInScrollView" /> </ScrollView> </TableLayout> <TableLayout android:id="@+id/rightTableLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="right" android:layout_alignParentRight="true" android:layout_alignParentLeft="false" android:layout_toLeftOf="@id/leftTableLayout" android:layout_alignParentTop="true" android:layout_alignParentEnd="true"> <TextView android:id="@+id/dayTimeSideView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentLeft="true" android:textColor="@android:color/white" /> <TextView android:id="@+id/takenIssued" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentLeft="true" /> <TextView android:id="@+id/takenIssuedNumbers" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentLeft="true" /> <TextView android:id="@+id/check" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentLeft="true" /> <TextView android:id="@+id/checkNumber" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentLeft="true" /> </TableLayout> </RelativeLayout>

And result of execute app without values is black screen, also after add values everything is fine.

Below add result of using axml from above. With changing values.

and without.

Do you have any ideas why is that?

Sign In or Register to comment.