2012-10-23 20 views
3

我有一個TextView,文字太長不能放在一行,我怎樣才能使這個多行TextView?我添加了android:singleline="false"屬性,但它不起作用。多行Textview

<TextView 
    android:text="some long text" 
    android:singleline="false" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content"   
/> 
+1

請張貼一些代碼或提供更多信息,以便我們可以幫助你。 –

+0

@DipakKeshariya我已添加驗證碼請檢查 –

+0

如果可能,請發佈您的完整xml,以便在發佈我的答案之前先測試。 –

回答

1

你並不需要給假SINGLELINE

只要給

android:maxLine="Here define the line max as you want" 

這將使你的文本添加在寬度和高度線的數量,您在其中定義。

1

可以使用android:minLines="3"textview

+1

上午使用Textview沒有EditText –

0

在我的模擬器測試後,我來到here..so做到這一點

t=(TextView)findViewById(R.id.t); 
    t.setText("This is first line \n This is second \n last line...."); 
+0

還有什麼困惑?隨時問.. :) :) –

0

android:maxLine="Define max line here" 
2

使用此

<TextView 
     android:id="@+id/yourTextView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:singleLine="false" 
     android:scrollHorizontally="false" 
     android:scrollbars="vertical" /> 
2

您在XML文件中寫的TextView

安卓的MaXLine =「這裏定義最大線」