I'm applying a hard-coded value ----
into the message body of a custom AlertDialog. In my device, it fits well since I used its dimesions, like below:
However on a large screen device, it will definitely appear different like this:
and the code to produce the dialog:
new AlertDialog.Builder(context)
.setTitle("Title goes here...")
.setMessage("-------------------------------")
(…)
I can use DisplayMetrics
to get the width of the dialog, but how do I now apply the width caught to the actual message?
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
final int DisplayWidth = displayMetrics.widthPixels;