zoukankan      html  css  js  c++  java
  • android怎么做表格显示数据

    实现思路:最底层(父级)背景为黑色,最上层(子级)背景为白色,然后父子组件之间存在一丝间隔即可显示出类似边框的线。

    本次主要利用Android中的TableRow等实现,其他类比也可以实现效果。

    <TableLayout
            android:layout_width="350dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="50dp"
            android:background="#000000"
            android:gravity="center">
    
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:padding="1dp">
    
                <TextView
                    android:id="@+id/textView14"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="#FFFFFF"
                    android:gravity="center"
                    android:text="车辆ID"
                    android:textColor="#000000"
                    android:textSize="18sp"
                    android:textStyle="bold" />
    
                <TextView
                    android:id="@+id/textView13"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="1dp"
                    android:layout_marginRight="1dp"
                    android:layout_weight="1"
                    android:background="#FFFFFF"
                    android:gravity="center"
                    android:text="充值金额"
                    android:textColor="#000000"
                    android:textSize="18sp"
                    android:textStyle="bold" />
    
                <TextView
                    android:id="@+id/textView12"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="#FFFFFF"
                    android:gravity="center"
                    android:text="充值时间"
                    android:textColor="#000000"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </TableRow>
    
        </TableLayout>
    

    效果:
    在这里插入图片描述

    另外,也可以使用ListView实现。

    感谢大佬:https://jingyan.baidu.com/article/c74d6000dea5ec0f6a595dda.html

  • 相关阅读:
    java代码 分解EXCEL(一)
    hdu 1226 BFS + bfs记录路径
    MVC-MODEL
    弱类型、强类型、动态类型、静态类型语言的区别是什么?
    Objective-C中的命名前缀说明
    self & this 上下文
    Object comparison
    Dynamic typing 动态类型
    iOS支付宝 9.x 版本首页效果
    Using an Image for the Layer’s Content
  • 原文地址:https://www.cnblogs.com/tfxz/p/12621617.html
Copyright © 2011-2022 走看看