【发布时间】:2017-06-19 14:59:27
【问题描述】:
我的目标是为推送通知设置 rtl 支持。我的通知会切换文本方向,但不会切换布局位置。例如图标总是在左边,标题在右边,文本在左边。我的猜测是一切都应该向左或向右。我尝试创建自定义 xml,但问题是我无法在远程视图上设置 layoutDirection。使用的代码:
标准通知:
mNotification = new NotificationCompat.Builder(context)
.setContentTitle(contentTitle)
.setContentText(contentText)
.setSmallIcon(appIcon)
.setContentIntent(contentIntent)
.setSound(soundUri)
.setAutoCancel(true)
.setWhen(started)
.build();
还有自定义xml:
RemoteViews contentView = new RemoteViews(context.getPackageName(), R.layout.my_id);
contentView.setImageViewResource(R.id.image, R.mipmap.ic_launcher);
contentView.setTextViewText(R.id.title, contentTitle);
contentView.setTextViewText(R.id.text, "Text "));
mNotification.contentView = contentView;
【问题讨论】:
标签: java android push-notification android-xml remoteview