0

情報が到着するのを待つテーブルレイアウトがあります。データが到着すると、テーブルに動的に入力します。しかし、電話を90度回転させると、テーブルが消えます。コード:

{
TableRow row;
TextView t1, t2;
ArrayList<InfoPair> values;
values = processResults(r);
Iterator it = values.iterator();

        while (it.hasNext()) {
            InfoPair pairs = (InfoPair) it.next();

            row = new TableRow(c);

            t1 = new TextView(c);
            t2 = new TextView(c);

            // t1.setTextLocale(new Locale("hu", "hu"));

            t1.setText(pairs.getLabel());
            t2.setText(pairs.getValue());

            t1.setWidth(200);
            t2.setWidth(280);

            t1.setBackgroundColor(Color.GRAY);
            t2.setBackgroundColor(Color.YELLOW);

            row.addView(t1);
            row.addView(t2);

            infoTable.addView(row);

            it.remove(); // avoids a ConcurrentModificationException
}

テーブルに情報を保持し、電話を回したときに消えないようにするにはどうすればよいですか?

4

1 に答える 1

0

最も簡単な方法

 <activity android:theme="@style/Theme.app" android:configChanges="orientation|screenSize" android:name=".YourActivity" android:label="@string/app_name"></activity>

これが主なものですandroid:configChanges="orientation|screenSize"

于 2012-12-27T09:10:51.310 に答える