Android AlertDialog在某些设备上不显示整个setMessage
问题描述:
这是一个最近才引起我注意的奇怪情况。我有一个活动,在创建AlertDialog时会显示警告,以警告用户完成需要重新启动的过程。在我的设备上(Galaxy Nexus),它显示得很好。最近才引起我注意的是,在许多其他设备上,它只能在切断前显示几个字。Android AlertDialog在某些设备上不显示整个setMessage
AlertDialog.Builder builder = new AlertDialog.Builder(ReportActivity.this);
builder.setTitle("Finished!");
builder.setMessage("Due to the different storage mediums across the various Android devices this app may eb used for, "
+"I've decided not to force a media rescan because depending on your device, "
+"it may or may not even be possible. "
+"This means that you will need to reboot your device or unmount/mount your sdcard in the Settings app before most players will pull in all the information for the songs."
+"\n Please reboot or rescan before claiming that the app did not work.")
.setCancelable(false)
.setPositiveButton("Dismiss", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
lv1.setAdapter(new ResultsAdapter(ReportActivity.this, results));
}
});
AlertDialog alert = builder.create();
alert.show();
答
而不是使用setMessage()
,尝试setView()
,提供自己的TextView
在那里你可以控制所显示的行数。
+1
生病了,但为了将来的参考,你有什么想法为什么它的行为方式这是?以前从未有过这样的问题。它不仅仅是这个屏幕让我感到悲伤。我有另一个屏幕与一个textview和一个按钮,在我的设备上显示罚款,只显示其他一些单行。 – r2DoesInc 2012-03-03 02:06:59
答
直接设置视图不干活不得不指定新线\ n和也定义了Android线无:行属性
相关:http://*.com/questions/9795347/long文字转到下一行ics-but-not-on-gb-and-below/9847862 – Blundell 2012-03-23 23:47:27