AndroidStdio TableLayout表格布局实现帮助界面

AndroidStdio TableLayout表格布局实现帮助界面

先看效果图:

在这里插入图片描述

帮助界面包括上面的图片区以及下面的表单区。下面的帮助信息采用表格布局实现,蓝色字体是网页链接,可以点击查看内容(该功能这里不做实现,会在之后发布)。代码放在最后面,下面简单说一下表格布局。

概览

Tablelayout类以行和列的形式对控件进行管理,每一行为一个TableRow对象,或一个View控件。

特点

直接往TableLayout中添加组件,那么这个组件将占满一行
TableRow是容器,把多个组件放在里面

TableRow的宽度会占满父布局,设置其他值不生效

表格的行数由TableRow的个数决定

常用属性

android:collapseColumns:设置需要被隐藏的列的序号

android:shrinkColumns:设置允许被收缩的列的列序号

android:stretchColumns:设置运行被拉伸的列的列序号

示例可看:https://www.jianshu.com/p/77599d96d499

帮助界面代码

<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".HelpActivity">

    <ImageView
        android:id="@+id/imageView5"
        android:layout_width="match_parent"
        android:layout_height="178dp"
        app:srcCompat="@drawable/help" />

    <TextView
        android:id="@+id/textView10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:textSize="30dp"
        android:text="帮助信息" />

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="50dp">

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="155dp"
                android:textSize="20dp"
                android:text="第一章:" />
            <TextView
                android:id="@+id/textView11"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="20dp"
                android:textColor="@color/colorhelp"
                android:text="产品简介" />
        </TableRow>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="30dp">

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="155dp"
                android:textSize="20dp"
                android:text="第二章:" />
            <TextView
                android:id="@+id/textView21"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="20dp"
                android:textColor="@color/colorhelp"
                android:text="快速入门" />
        </TableRow>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="30dp">

            <TextView
                android:id="@+id/textView3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="155dp"
                android:textSize="20dp"
                android:text="第三章:" />
            <TextView
                android:id="@+id/textView31"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="20dp"
                android:textColor="@color/colorhelp"
                android:text="使用说明" />
        </TableRow>


    </TableLayout>
</LinearLayout>
extColor="@color/colorhelp"
                android:text="使用说明" />
        </TableRow>


    </TableLayout>
</LinearLayout>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值