[英]Android TextView's stopped wrapping text
我花了很多時間尋找解決方案,但是沒有發現任何與我所遇到的相似的東西。 當我在G2上運行我的應用程序時,我的所有textview都不會換行。(不管視圖有多大。)如果我在模擬器上運行,它們會自動換行。 部署到我的G2時,其他所有應用程序似乎都沒有這個問題。 我關閉了設備的電源,重新創建了布局,等等。這似乎甚至影響了此特定應用程序中的標准警報對話框。 這在我所有的活動中都在發生。 有沒有人看到過這樣的東西,或者有人知道我應該看什么?
一些要求的代碼...
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();
標准警報對話框不會換行。 它顯示了一條拖離視圖的線。
好,所以我想通了。
我有一個主題應用於父主題Theme.Holo
。
當我刪除該主題作為父主題時,我的textviews
再次開始環繞! 我不知道為什么在不了解Theme.Holo
的設備上運行時會感到困惑。
因此,我剛剛創建了一個附加的values-v13
目錄並修改了主題。 對不起麻煩的人。
除了Larry McKenzie的答案,我還必須為TextView設置相應的參數:
android:ellipsize="none"
android:maxLines="20"
android:scrollHorizontally="false"
android:singleLine="false"
例:
<TextView
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="none"
android:maxLines="20"
android:scrollHorizontally="false"
android:singleLine="false"
android:text="@string/my_text" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.