布局格式不合适

时间:2016-03-17 13:32:47

标签: android layout

我正在为我们的应用创建报告,因为我有4个字段。所以问题是如果第一列值很小,那么第二列立即开始。我只想创建一个列,第一列的所有起点都相同。对于第二列,所有起点都相同。下面是代码。我正在使用卡片布局。

memberlist.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:id="@+id/relvMain"
    android:background="@color/background">
    <RelativeLayout 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:orientation="horizontal"
        tools:context=".MemberList">
        <TableLayout
            android:padding="4dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id ="@+id/header"
            android:stretchColumns="1">
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/headingtrn1"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:maxWidth="@dimen/report_textview_size"
                    android:text="trnno"
                    android:textColor="@color/textview_all"
                    android:textSize="@dimen/textview_size" />

                <TextView
                    android:id="@+id/headingtrn2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/textview_all"
                    android:text="trndate"
                    android:textSize="@dimen/textview_size"
                    android:maxWidth="@dimen/report_textview_size"
                    android:layout_marginLeft="@dimen/report_marginleft_big"
                    android:layout_marginStart="@dimen/report_marginleft_big" />

                <TextView
                    android:id="@+id/headingtrn3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/textview_all"
                    android:text="customer"
                    android:textSize="@dimen/textview_size"
                    android:maxWidth="@dimen/report_textview_size"
                    android:layout_marginLeft="@dimen/report_marginleft_big"
                    android:layout_marginStart="@dimen/report_marginleft_big" />

                <TextView
                    android:id="@+id/headingtrn4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="amount"
                    android:textColor="@color/textview_all"
                    android:textSize="@dimen/textview_size"
                    android:maxWidth="@dimen/report_textview_size"
                    android:layout_marginLeft="@dimen/report_marginleft_big"
                    android:layout_marginStart="@dimen/report_marginleft_big"/>

                <TextView
                    android:id="@+id/headingtrn5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/textview_all"
                    android:text="status"
                    android:textSize="@dimen/textview_size"
                    android:maxWidth="@dimen/report_textview_size"
                    android:layout_marginLeft="@dimen/report_marginleft_big"
                    android:layout_marginStart="@dimen/report_marginleft_big" />
            </TableRow>
        </TableLayout>
        <android.support.v7.widget.RecyclerView
            android:id="@+id/cardmlist"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical"
            android:layout_marginTop="50dp"/>
</RelativeLayout>
</LinearLayout>

card_item_memberlist.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.CardView
        android:id="@+id/card_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        card_view:cardCornerRadius="4dp"
        android:layout_margin="5dp">

        <TableLayout
            android:padding="4dp"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id ="@+id/cardMemberlist"
            android:stretchColumns="1">
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/firmname"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:maxWidth="@dimen/report_textview_size"
                    android:text="trndate"
                    android:gravity="start"
                    android:textColor="@color/textview_all"
                    android:textSize="@dimen/textview_size" />

                <TextView
                    android:id="@+id/membername"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/textview_all"
                    android:text="Name"
                    android:gravity="start"
                    android:textSize="@dimen/textview_size"
                    android:maxWidth="@dimen/report_textview_size"
                    android:layout_marginLeft="@dimen/report_marginleft"
                    android:layout_marginStart="@dimen/report_marginleft" />

                <TextView
                    android:id="@+id/mobileNO"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/textview_all"
                    android:text="credit"
                    android:gravity="start"
                    android:textSize="@dimen/textview_size"
                    android:maxWidth="@dimen/report_textview_size"
                    android:layout_marginLeft="@dimen/report_marginleft"
                    android:layout_marginStart="@dimen/report_marginleft" />

                <TextView
                    android:id="@+id/commision"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="debit"
                    android:gravity="start"
                    android:textColor="@color/textview_all"
                    android:textSize="@dimen/textview_size"
                    android:maxWidth="@dimen/report_textview_size"
                    android:layout_marginLeft="@dimen/report_marginleft"
                    android:layout_marginStart="@dimen/report_marginleft"/>

                <TextView
                    android:id="@+id/balance"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/textview_all"
                    android:text="balance"
                    android:weight="1"
                    android:textSize="@dimen/textview_size"
                    android:maxWidth="@dimen/report_textview_size"
                    android:layout_marginLeft="@dimen/report_marginleft"
                    android:layout_marginStart="@dimen/report_marginleft" />

            </TableRow>
        </TableLayout>
    </android.support.v7.widget.CardView>
</LinearLayout>
在图片中你可以看到问题 图片 enter image description here

0 个答案:

没有答案
相关问题