画像のリストを RemoteView にロードする必要があります。その目的のために、ViewFlipper を使用して、ユーザーが次のボタンと前のボタンをクリックしたときに表示します。しかし、私が ViewFlipper で直面している問題は、画像を動的に追加できなかったことですが、ViewFlipper 内でローカルにドローアブルから画像をロードすると、出力が一度得られます。よろしくお願いします。RemoteViews でこれに対する解決策を見つけることができませんでした。次のように、参照用にコードを投稿しています。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
RemoteViews expandedView = new RemoteViews(this.getPackageName(), R.layout.notification_viewflipper);
expandedView.setOnClickPendingIntent(R.id.img_left,getPendingSelfIntent(MainActivity.this, IMAGE_LEFT));
expandedView.setOnClickPendingIntent(R.id.img_right,getPendingSelfIntent(MainActivity.this, IMAGE_RIGHT));
}
protected PendingIntent getPendingSelfIntent(Context context, String action) {
Intent intent = new Intent(context,MyNotificationReceiver.class);
intent.setAction(action);
return PendingIntent.getBroadcast(context, 0, intent, 0);
}
あらゆる種類のヒントやヒントは、私にとって非常に役立ちます。前もって感謝します。