简体   繁体   English

Android应用的TableLayout中的自定义表格行

[英]Custom table row in TableLayout of android app

I want to create a table layout with custom table rows. 我想用自定义表格行创建表格布局。 Those rows should be like iPhone iBooks books shelf's like: 这些行应该像iPhone iBooks书架一样:

图片1

I believe the easiest way to do this is to create table layout with custom rows which would have image like one book shelf. 我相信最简单的方法是使用自定义行创建表格布局,这些行将具有像一个书架的图像。 This should be done in xml, i don't have many experience with this. 这应该在xml中完成,我对此没有很多经验。 Then by coding i would books images. 然后通过编码我会预定图像。

But i am new to programming android, so if there are easier way please tell me. 但是我是Android编程的新手,所以如果有更简单的方法,请告诉我。

So maybe someone could give me tutorials or explain how to do this. 所以也许有人可以给我教程或解释如何做。 For now i have this: 现在我有这个:

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

    <TableLayout
        android:id="@+id/tableLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

    </TableLayout>

</RelativeLayout>

Thanks. 谢谢。

Yes, 是,

If there are limited data then you can use the TableLayout. 如果数据有限,则可以使用TableLayout。 and If you are using the TableView then the easiest way is you have to put the Image as background of table row. 如果您使用的是TableView,那么最简单的方法是将Image作为表行的背景。

Or 要么

If there are many data then you can use ListView and for earch row of ListView you can set the background of that image. 如果数据很多,则可以使用ListView,对于ListView的earch行,可以设置该图像的背景。

Enjoy. 请享用。 :) :)

Keep Coading . 继续加油。 . . .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM