java - Localing the app makes dialogues look too small -
after translated app, made possible users change locale. doing made dialogues show small. why? how can fix it?
code localizing:
locale.setdefault(locale); configuration config = new configuration(); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics());
code showing dialog:
final dialog dialog = new dialog(mcontext); dialog.settitle(context.getresources().getstring(r.string.rate) + app_title + "!"); linearlayout ll = new linearlayout(mcontext); ll.setorientation(linearlayout.vertical); textview tv = new textview(mcontext); tv.settext(context.getresources().getstring(r.string.if_you_enjoy_using) + app_title + context.getresources().getstring( r.string.please_take_a_moment_to_rate_it_thanks_for_your_support)); tv.setwidth(240); tv.setpadding(4, 0, 4, 10); if (locale.getdefault().getlanguage().equals("ja")) { tv.settextsize(13); } ll.addview(tv); button b1 = new button(mcontext); b1.settext(context.getresources().getstring(r.string.rate) + app_title); b1.setonclicklistener(new onclicklistener() { public void onclick(view v) { <code> } }); ll.addview(b1); button b2 = new button(mcontext); b2.settext(r.string.remind_me_later); b2.setonclicklistener(new onclicklistener() { public void onclick(view v) { <code> } }); ll.addview(b2); button b3 = new button(mcontext); b3.settext(r.string.no_thanks); b3.setonclicklistener(new onclicklistener() { public void onclick(view v) { <code> } }); ll.addview(b3); dialog.setcontentview(ll); dialog.show();
the dialogues: before:
after:
after debugging problem this:
getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics());
if drop it, dialogues return normal, app not localized...
Comments
Post a Comment