我花了很多时间寻找这个问题的解决方案,但没有找到任何与我所遇到的相似的东西。当我在我的 G2 上运行我的应用程序时,我的 TextView 没有一个换行文本。(无论 View 有多大。)如果我在模拟器上运行它,它们会适本地换行。当部署到我的 G2 时,我的其他应用程序似乎都没有这个问题。我对我的设备进行了电源循环、重新创建布局等。这似乎甚至影响了这个特定应用程序中的标准警报对话框。它发生在我所有的 Activity 中。有没有人见过这样的东西,或者有人知道我应该看什么?
一些请求的代码...
AlertDialog.Builder eula = new AlertDialog.Builder(activity)
.setTitle(R.string.eula_title)
.setIcon(android.R.drawable.ic_dialog_info)
.setMessage(R.string.eula_text)
.setCancelable(accepted)
.setPositiveButton(R.string.eula_accept,
new android.content.DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
setAcceptedEula(activity);
dialog.dismiss();
mHandler.post(mSplashScreen.launch);
}
})
.setNegativeButton(R.string.eula_decline,
new android.content.DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
activity.finish();
}
});
eula.show();
标准警报对话框不会换行文本。它显示了一条从 View 中拖出的线。
最佳答案
好的,我想通了。
我有一个应用于我的应用程序的主题,其父主题为 Theme.Holo
。
当我删除作为父主题的那个主题时,我的 textviews
又开始换行了!我不知道为什么在不理解 Theme.Holo
的设备上运行时会感到困惑。
所以我刚刚创建了一个额外的 values-v13
目录并修改了我的主题。抱歉给大家带来麻烦。
关于Android TextView 停止换行文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8922671/