0
我有要求将图像列表加载到RemoteView中。为此,我使用ViewFlipper来显示用户何时单击下一个和上一个按钮。但是我面对ViewFlipper的问题是我无法动态地添加图像,而如果我在ViewFlipper本地加载绘图的图像,则会获得一次输出。请帮忙。我无法通过RemoteViews找到解决方案。我张贴我的代码,供您参考如下:如何将图像动态添加到RemoteView下的ViewFlipper中
@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);
}
任何种类的技巧和提示的将是对我很大的帮助。提前致谢。