2012-10-23 19 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 =“这里定义最大线”