Android 远程视图未根据语言选择正确的布局
Android Remote View not picking up the correct layout based on the language
我正在开发一款同时支持英语和阿拉伯语的应用程序。该应用程序向我正在使用远程的用户显示自定义通知 views.I 已添加英语和阿拉伯语的布局是各自的布局资源文件。
我的问题是当应用语言为英语时我的应用显示正确的通知,但是当我将语言更改为阿拉伯语时它没有选择阿拉伯语布局,它仍然显示英语布局。
仅供参考:- 我正在使用服务来显示通知(因为我需要进行一些网络调用)。
RemoteViews largeRemoteView = new RemoteViews(context.getPackageName(), R.layout.layout_new_download_notification);
RemoteViews smallRemoteView = new RemoteViews(context.getPackageName(), R.layout.layout_new_download_notification_small);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
Notification notification = builder.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_MAX)
.build();
notificationManager.notify(mNotificationId, notification);
我在布局和 layout-ar 文件中都有 layout_new_download_notification
和 layout_new_download_notification_small
,但是 android 在语言更改时没有选择阿拉伯语布局。
提前致谢
将设备语言更改为特定语言就可以了
我正在开发一款同时支持英语和阿拉伯语的应用程序。该应用程序向我正在使用远程的用户显示自定义通知 views.I 已添加英语和阿拉伯语的布局是各自的布局资源文件。
我的问题是当应用语言为英语时我的应用显示正确的通知,但是当我将语言更改为阿拉伯语时它没有选择阿拉伯语布局,它仍然显示英语布局。
仅供参考:- 我正在使用服务来显示通知(因为我需要进行一些网络调用)。
RemoteViews largeRemoteView = new RemoteViews(context.getPackageName(), R.layout.layout_new_download_notification);
RemoteViews smallRemoteView = new RemoteViews(context.getPackageName(), R.layout.layout_new_download_notification_small);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
Notification notification = builder.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_MAX)
.build();
notificationManager.notify(mNotificationId, notification);
我在布局和 layout-ar 文件中都有 layout_new_download_notification
和 layout_new_download_notification_small
,但是 android 在语言更改时没有选择阿拉伯语布局。
提前致谢
将设备语言更改为特定语言就可以了