Is it possible to right-justify the text in an AlertDialog's title and message?
I am showing Hebrew messages but they are showing up left justified.
A simple dialog containing an DatePicker . This class was deprecated in API level 26.
AlertDialog is a lightweight version of a Dialog. This is supposed to deal with INFORMATIVE matters only, That's the reason why complex interactions with the user are limited. Dialog on the other hand is able to do even more complex things .
setIcon() method is use to set the icon on Alert dialog box.
AlertDialog. A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout. DatePickerDialog or TimePickerDialog. A dialog with a pre-defined UI that allows the user to select a date or time.
This is an old question, but there is a very simple solution. Assuming you are using MinSdk 17
, you can add this to your styles.xml
:
<style name="AlertDialogCustom" parent="ThemeOverlay.AppCompat.Dialog.Alert">
<item name="android:layoutDirection">rtl</item>
</style>
And in the AlertDialog.Builder
you just need to specify this AlertDialogCustom
in the constructor:
new AlertDialog.Builder(this, R.style.AlertDialogCustom)
.setTitle("Your title?")
.show();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With