Android AlertDialog在某些设备上不显示整个setMessage

时间:2012-03-03 00:35:52

标签: android alertdialog

这是一个奇怪的案例,最近刚引起我的注意。我有一个活动,它在创建时显示AlertDialog,以警告用户完成重启所需的过程。在我的设备(Galaxy Nexus)上显示它很好。最近我注意到,在很多其他设备上它只会在被切断之前显示几个字。

        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();

Galaxy Nexus

Motorola Photon

2 个答案:

答案 0 :(得分:4)

尝试setMessage(),而不是使用setView(),提供您自己的TextView,您可以在其中控制显示的行数。

答案 1 :(得分:0)

直接设置视图不起作用。我必须为新行指定\ n,并且还使用android:lines属性定义没有行