以下布局的表格式未在android中显示

以下布局的表格式未在android中显示,android,layout,Android,Layout,您好,在下面的代码中,我正在显示一个表格布局,以在表格布局中显示表格行 在用户名要显示行,然后电子邮件要显示行之后,用行分隔的每一行都要显示。 有谁能帮我添加垂直线来分隔每一行吗 请检查下面的代码并让我知道 [![在下面的屏幕中描述了我要添加的每一行,每一行用行分隔。如行][1][1] [![<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com

您好,在下面的代码中,我正在显示一个表格布局,以在表格布局中显示表格行

在用户名要显示行,然后电子邮件要显示行之后,用行分隔的每一行都要显示。 有谁能帮我添加垂直线来分隔每一行吗

请检查下面的代码并让我知道

[![在下面的屏幕中描述了我要添加的每一行,每一行用行分隔。如行][1][1]

[![<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/realmsbg">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_marginTop="20dp"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="15dp"
            android:gravity="center_horizontal"
            android:background="@drawable/layout_border">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/manage_operator"
                    android:layout_centerHorizontal="true"
                    android:padding="12dp"
                    android:background="@drawable/layout_border"
                    android:textColor="#fff"
                    android:textSize="15sp"
                    android:textStyle="bold"
                    android:gravity="center"
                    android:text="Manage Operator List"/>



                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TableLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent">
                        <TableRow
                            android:background="@color/color_gray"
                            android:padding="@dimen/dimen_8dp">
                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Username"
                                android:id="@+id/txtRank"
                                android:textColor="@android:color/white" />
                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Email"
                                android:id="@+id/txtMovieName"
                                android:textColor="@android:color/white" />
                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Mobile"
                                android:id="@+id/txtYear"
                                android:textColor="@android:color/white" />
                        </TableRow>


                    </TableLayout>
                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/my_recycler_view"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:divider="@null"
                        android:nestedScrollingEnabled="false"
                        />
                    <TextView
                        android:id="@+id/empty_view"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center"
                        android:text="No Records"
                        android:visibility="gone" />


                </LinearLayout>


        </LinearLayout>

</LinearLayout>][1]][1]
[[
][1]][1]

您的主要活动布局XML文件和项目布局XML文件

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

    <LinearLayout
            android:id="@+id/llHeader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/toolbar"
            android:background="@android:color/black"
            android:orientation="horizontal"
            android:paddingTop="@dimen/_8sdp"
            android:paddingBottom="@dimen/_8sdp"
            android:weightSum="3">

        <TextView
                style="@style/textBlackBold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Username" />

        <TextView
                style="@style/textBlackBold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Email" />

        <TextView
                style="@style/textBlackBold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Mobile" />
    </LinearLayout>

    <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerDayAttendance"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/llTotal"
            android:layout_below="@+id/view1" />
</LinearLayout>

TableRow
s只是专门的水平
LinearLayout
s,因此您可以使用
android:dividers
android:showDividers
属性添加这些属性,如以下答案所示:。