android - 以下布局的表格格式未在 android 中显示
问题描述
嗨,在下面的代码中,我正在显示一个表格布局以在表格布局中显示表格行。
用行分隔的每一行要在用户名要显示行之后要显示,然后电子邮件要显示行。任何人都可以帮助我如何添加垂直线来分隔每一行。
请检查以下代码并告诉我
[![在下面的屏幕中描述了我想添加用行分隔的每一行 .like row][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]
解决方案
您的主要活动布局 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>
推荐阅读
- python - 如何在函数中使用 try?
- validation - 针对逻辑错误的 Google 表单 Google Apps 脚本答案验证
- java - 如何使用 Jsonpath 从 JAVA 中的嵌套 JSON 中获取值
- r - 生成大位数范围内的素数(数字 > 10 位)
- csvhelper - CsvHelper 创建一个 ClassMap
包含一个属性作为列表项写入 csv 文件 - python - 名称“get_object_or_404”未定义
- node.js - 将mern堆栈部署到heroku时前端不起作用
- kubernetes - Kubernetes 不显示所有组件状态
- ios - 将各种自定义 UIView 组合在一起以将它们作为一个组进行缩放和翻译
- docker - 在 Nomad 中安全地分发 Docker 凭证