I have noticed that when I show notification with RTL title or any RTL text it is aligned to left instead of right side.
The problem only occurs when:
- the device language is set to LTR language (e.g. English) and text in notification should be RTL
- on Android 7.1.1 RTL text is aligned to right, but on Android 10 RTL text is aligned to left
Is there a solution to show text with proper alignment no matter the device language?
How it looks right now:
Code:
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationManager.createNotificationChannel(
NotificationChannel(CHANNEL_ID, "Test", NotificationManager.IMPORTANCE_HIGH)
)
}
val builder = NotificationCompat.Builder(this, CHANNEL_ID).apply {
setSmallIcon(R.drawable.ic_launcher_foreground)
setContentTitle("تجربة")
}
notificationManager.notify(NOTIFICATION_ID, builder.build())
