1

のような cicle を使用して、相対レイアウトでビューを動的に追加するにはどうすればよいforですか?

これは私のコードです:

RemoteViews remoteViews = new RemoteViews(c.getPackageName(), R.layout.layout_1);

    for(int i=0; i<10; i++){
            RemoteViews newView = new RemoteViews(c.getPackageName(), R.layout.element);
            newView.setImageViewResource(R.id.notif_toggle, R.drawable.bt_close_n);
            remoteViews.addView(R.id.layout_1, newView);

    }
            int statusIcon = R.drawable.ic_launcher;
            notification = new Notification(statusIcon, c.getResources().getString(R.string.app_name), System
                    .currentTimeMillis());
            notification.flags = notification.flags | Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;

            notification.contentView = remoteViews;

            nm.notify(3,notification);

「追加されるビューの子には属性 layout_alignParentBottom="true" があり、これにより親全体が塗りつぶされ、追加の子がブロックされました。属性を削除すると、他の子が表示されるようになりました」.

では、layout_alignParentBottom="false" を設定するにはどうすればよいでしょうか?? どうもありがとうございました...

4

1 に答える 1

0

ここで何をしようとしているのかはわかりませんが、おそらく ListView を求めています。

于 2012-10-07T22:39:08.563 に答える