Android 通过sql循环向TableRow动态添加多个TextView

Android 通过sql循环向TableRow动态添加多个TextView,android,textview,android-linearlayout,tablerow,Android,Textview,Android Linearlayout,Tablerow,我在这里搜索了又搜索,但我似乎无法解决这个问题。我有一个滚动视图,在滚动视图中有一个线性布局,我想读取我的SQL数据库并像这样显示结果 Linear Layout ScrollView Linear Layout TableRow TextView TextView TableRow TextView Te

我在这里搜索了又搜索,但我似乎无法解决这个问题。我有一个
滚动视图
,在
滚动视图
中有一个
线性布局
,我想读取我的SQL数据库并像这样显示结果

Linear Layout
    ScrollView
        Linear Layout
            TableRow
               TextView
               TextView
            TableRow
               TextView
               TextView
        /Linear Layout
    /ScrollView
/LinearLayout
我的代码如下:

TableRow tRow;
            ContextThemeWrapper ttRow = new ContextThemeWrapper(this, R.style.coreTable);
            LinearLayout LL = (LinearLayout) findViewById(R.id.linearCores);
            LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);



            if (cores.moveToFirst()) {
                while (cores.isAfterLast() == false) {
                    Log.e("CORE LIST", cores.getString(1));
                    tRow = new TableRow(ttRow);
                    tRow.setLayoutParams(lp);
                    tRow.setOrientation(TableRow.VERTICAL);
                    tRow.setId(cores.getInt(0));
                    tRow.setBackgroundResource(R.drawable.shape_border);
                    ContextThemeWrapper newTxtA = new ContextThemeWrapper(this, R.style.coreHeaderView);
                    TextView tTextA = new TextView(newTxtA);
                    tTextA.setLayoutParams(lp);
                    tTextA.setText(cores.getString(1) + " (Lvl " + cores.getString(2) + ")");
                    tRow.addView(tTextA);
                    TextView tTextB = new TextView(coreChooser.this);
                    tTextB.setLayoutParams(lp);
                    tTextB.setText(cores.getString(5));
                    tRow.addView(tTextB);
                    LL.addView(tRow);
                    cores.moveToNext();
                }
            }
在我的模拟器上,它显示了第一个
tRow.addView
,但没有显示其余的,不过背景看起来已经超出了屏幕

我真的不确定我在这里做错了什么。

文档说明了以下内容:

应始终将
表格行
用作
表格布局
的子级。如果
表格行
的父级不是
表格布局
,则
表格行
将作为水平
线性布局

如果您的目的只是使每对
TextView
共享公共背景
R.drawable.shape_border
,则使用嵌套的
LinearLayout
代替
TableRow
TableRow
是从
LinearLayout
扩展而来的)

或者,如果您绝对希望使用
TableRow
的某些特定功能,则将
R.id.linearCores
a
TableLayout
而不是
LinearLayout