android sqlite打印数据,如何将数据库打印为表格? (Android,SQLite)

表没有得到很好的android系统中清除难度比预期的那么我犯了一个新招数来填充下一个水平文本视图布局正常的列表视图这里是如何只要按照我的领导,这是用来检索队的表

主要活动::

public class ViewAllScores extends ListActivity {

@Override

protected void onCreate(Bundle savedInstanceState) {

// TODO Auto-generated method stub

super.onCreate(savedInstanceState);

setContentView(R.layout.table_total_scores_by_exam);

generateTable();

}private void generateTable() {

// TODO Auto-generated method stub

setContentView(R.layout.table_total_scores_by_exam);

mDbHelper = new DBhelp(this);

mDbHelper.open();

String ExamID = "1";

mNotesCursor = mDbHelper.getAllTeamsScoresByExam(ExamID);

startManagingCursor(mNotesCursor);

String[] from = new String[] { mDbHelper.KEY_TEAMS_TEAMNAME,

mDbHelper.KEY_SCORES_TOTALSCORE,

mDbHelper.KEY_SCORES_TIMEELAPSED };

int[] to = new int[] { R.id.tblTablesTeamsByExamRowsTeamName,

R.id.tblTablesTeamsByExamRowsTeamScore,

R.id.tblTablesTeamsByExamRowsElapsedTime };

SimpleCursorAdapter notes = new SimpleCursorAdapter(this,

R.layout.table_teams_by_exams_rows, mNotesCursor, from, to);

setListAdapter(notes);

}

数据库活动:

public Cursor getAllTeamsScoresByExam(String examID) {

// TODO Auto-generated method stub

String where = KEY_SCORES_SCOREDEXAMID + "=?";

String[] whereArgs = new String[] { examID };

Cursor cursor = ourDatabase.query(VIEW_TEAMS_SCORES_BY_EXAM,

new String[] { KEY_SCORES_SCOREDEXAMID, KEY_SCORES_TIMEELAPSED,

KEY_SCORES_TOTALSCORE ,KEY_SCORES_TEAMTRANSID,

KEY_TEAMS_TEAMNAME }, where, whereArgs, null, null,

KEY_SCORES_TOTALSCORE+" DESC");

return cursor;

} 从数据库中的分数

R.layout.table_total_scores_by_exam:

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:orientation="horizontal"

android:weightSum="99" >

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="33"

android:background="@drawable/cell_shape"

android:gravity="center"

android:text="Team Name"

android:textSize="30sp"

android:textStyle="bold" />

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="33"

android:background="@drawable/cell_shape"

android:gravity="center"

android:text="Total Score"

android:textSize="30sp"

android:textStyle="bold" />

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="33"

android:background="@drawable/cell_shape"

android:gravity="center"

android:text="Elapsed Time"

android:textSize="30sp"

android:textStyle="bold" />

android:id="@+id/android:list"

android:layout_width="match_parent"

android:layout_height="wrap_content" >

R.layout.table_teams_by_exams_rows:

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:orientation="horizontal"

android:weightSum="99" >

android:id="@+id/tblTablesTeamsByExamRowsTeamName"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="33"

android:background="@drawable/cell_shape"

android:gravity="center"

android:text="Team Name"

android:textSize="22sp"

/>

android:id="@+id/tblTablesTeamsByExamRowsTeamScore"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="33"

android:background="@drawable/cell_shape"

android:gravity="center"

android:text="Total Score"

android:textSize="22sp"

/>

android:id="@+id/tblTablesTeamsByExamRowsElapsedTime"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="33"

android:background="@drawable/cell_shape"

android:gravity="center"

android:text="Elapsed Time"

android:textSize="22sp"

/>

希望这一招可以帮助

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值