如何设计的Andr​​oid表 [英] how to design a table in android

查看:203
本文介绍了如何设计的Andr​​oid表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序我需要设计像下面的图片

in my app i need to design like the following image

我使用该表的布局,但我得到这样follwing:

i use table layout for this but i get like follwing:

TextViewTextViewTextView
.....

TextViewTextViewTextView .....

我的code:

   ....... 
<TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/tableLayout1">
<TableRow android:id="@+id/tableRow1" android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView android:layout_width="fill_parent" android:text="Your State"
       android:layout_gravity="left" android:id="@+id/textView1"
       android:layout_height="wrap_content">
    </TextView>
    <TextView android:layout_width="wrap_content" android:text="Your State"
       android:layout_gravity="left" android:id="@+id/textView1"
       android:layout_height="wrap_content">
    </TextView>
</TableRow>
     .........

我的设计是不是像上面那样的形象。我不知道如何确切的设计上面的图片。请大家帮我

my design is not shown as above image. i do not know how to design exact the above image. please help me

推荐答案

您应该有六个tablerows于表的布局和每个tablerow的对子级由四个textviews。

You should have six tablerows intable layout and each tablerow whould consists of four textviews.

<?xml version="1.0" encoding="utf-8"?>
<TableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TableRow>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text=""
            android:textColor="#ffffff"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Password:"
            android:textColor="#ffffff"
            android:textStyle="bold" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Pas111"
            android:textColor="#ffffff"
            android:textStyle="bold" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Pas111"
            android:textColor="#ffffff"
            android:textStyle="bold" />
    </TableRow>

    <TableRow>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Password"
            android:textColor="#ffffff"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Pas111"
            android:textColor="#ffffff"
            android:textStyle="bold" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Pas111"
            android:textColor="#ffffff"
            android:textStyle="bold" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Pas111"
            android:textColor="#ffffff"
            android:textStyle="bold" />
    </TableRow>
</TableLayout>

这篇关于如何设计的Andr​​oid表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆