SQLite数据库表格显示格式

时间:2013-03-17 06:14:41

标签: android sqlite

我为我的Android应用程序创建了一个sqlite数据库。我有两个文本视图和一个更新按钮,可以在db中插入这些值。由于我在android:stretchColumns="*"中使用了<TableLayout>标记,因此最初表格列表标签看起来不错。但是当我创建一个条目时,值不会显示在特定列下! 我希望列格式正确。如何才能做到这一点?有什么建议?提前致谢。这是我的视图数据库代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="#cc0000"
android:fadingEdge="vertical"
android:orientation="vertical" >

<TableLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:stretchColumns="*" >

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

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="50"
            android:text="ID"
            android:textColor="#eeddff"
            android:textSize="15sp"
            android:textStyle="italic"
            android:typeface="serif" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="50"
            android:text="Subject Name"
            android:textColor="#eeddff"
            android:textSize="15sp"
            android:textStyle="italic"
            android:typeface="serif" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="50"
            android:text="Assignment Number"
            android:textColor="#eeddff"
            android:textSize="15sp"
            android:textStyle="italic"
            android:typeface="serif" />
    </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="5">

        <TextView
            android:id="@+id/dataDisplay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#eeddff"
            android:textSize="15sp"
            android:textStyle="italic"
            android:typeface="serif" />
    </TableRow>
</TableLayout>

0 个答案:

没有答案
相关问题