0

私はこのようなものを持っています:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

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

            <TextView
                android:id="@+id/chooseBirthDateText"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="25dp"
                style="@style/mediumText"
                android:gravity="center_horizontal"
                android:text="@string/choose_birth_date" />

        </TableRow>
    </TableLayout>
</ScrollView>

さらに行を追加したいのですが、しばらくしてから(10秒としましょう)。最初にそれらの行を非表示にしてから、表示することを考えました。しかし、そのようにすると、スクロールビューが思い通りに機能しません(下に何もなくても下にスクロールできます-行が見えないため)

だから私は2番目のファイルに追加したい行を作成し、それらを途中でロードし、表示されなければならない瞬間にtableRow1の後に追加することを考えました。残念ながら、私はそれを行う方法がわかりません(Javaで2番目のファイルを作成するのではなく、2つのファイルを接続することについて話している):/

4

2 に答える 2

1

ビューを非表示にするモードは 2 つあります。

  • INVISIBLE: このビューは非表示ですが、レイアウトのためにスペースを占有します。
  • GONE: このビューは非表示で、レイアウト用のスペースを必要としません。

http://developer.android.com/reference/android/view/View.html#setVisibility(int)

役立つと思いGONEます。

于 2013-02-12T12:01:35.347 に答える
0

このように試してみてください。役に立ったかどうか教えてください。

    for(int i = 0; i < _attributeList.size();i++){


        TableRow newRow = new TableRow(getApplicationContext());
        newRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));

        newCheckBox = new CheckBox(getApplicationContext());

                TextView feeTypeText = new TextView(getApplicationContext());
                feeTypeText.setText(jsonObj.getString("feeType"));
                feeTypeText.setTextColor(Color.BLACK);
                feeTypeText.setTextSize(16f);
                feeTypeText.setTypeface(tf);

                TextView dueAmountText = new TextView(getApplicationContext());
                dueAmountText.setText(jsonObj.getString("dueAmount"));
                dueAmountText.setTextColor(Color.BLACK);
                dueAmountText.setTextSize(16f);
                dueAmountText.setTypeface(tf);

                TextView dueDateText = new TextView(getApplicationContext());
                dueDateText.setText(jsonObj.getString("dueDate"));
                dueDateText.setTextColor(Color.BLACK);
                dueDateText.setTextSize(16f);
                dueDateText.setTypeface(tf);

                newRow.addView(newCheckBox,(new LayoutParams(0,LayoutParams.WRAP_CONTENT,0.8f)));
                newRow.addView(feeTypeText,(new LayoutParams(0,LayoutParams.WRAP_CONTENT,0.8f)));
                newRow.addView(dueAmountText,(new LayoutParams(0,LayoutParams.WRAP_CONTENT,1.0f)));
                newRow.addView(dueDateText,(new LayoutParams(0,LayoutParams.WRAP_CONTENT,1.0f)));

attributeTable.addView(newRow); }

于 2013-02-12T12:07:36.307 に答える