Implementation of SQLite paging table improved by Android

Following the previous article about SQLite paging reading on Android, its function is to display data in a text box. This article will talk more deeply, implement and encapsulate an SQL paging table control, which not only supports paging, but also displays data in the form of tables.

Let's take a look at the animation of the program running in this article, as shown in the following figure:

The SQL paging table control is mainly divided into two parts: the "table area" and the "paging column", both of which are implemented based on GridView. Online introduction the demo of tables implemented on Android generally uses listview. Compared with GridView, the biggest advantage of listview is that the size of grid cells can be customized. A cell can be long and a cell can be short, but it is difficult to realize the structure of adaptive data table; The biggest advantage of GridView is the structure of adaptive data table, but the cell size is uniform. For the situation that the data table structure is changeable, it is recommended to use GridView to implement the table.

The SQL paging table control implemented in this paper has the following characteristics:

1. Adaptive data table structure, but the cell size is uniform;

2. Support paging;

3. The "table area" has key event callback processing, and the "page bar" has page switching event callback processing.

There are many program codes in this article. You can download the source code of the whole project here: http://xiazai.jb51.net/201408/yuanma/testSQLite (jb51.bet).rar

The code of items.xml is as follows. It is the cell implementation of "table area" and "page bar":

The code of main.xml is as follows:

The source code of the demo testsqlite.java is as follows:

The source code of the paging table control gvtable.java is as follows:

I hope the examples described in this paper can be used as a reference for everyone to develop Android projects.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>