在下一行中添加文本查看文本

时间:2014-10-30 07:11:24

标签: android android-linearlayout textview

我在一个水平方向的LinearLayout中有两个TextView。如果第二个文本视图超出特定长度,则它位于相同的文本视图下方,而不是添加为下一行。如何在下一行中显示秒文本视图的文本。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/notificationText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sample text1 Sample text1 Sample text1" />

    <TextView
        android:id="@+id/notificationText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sample text2 Sample text2 Sample text2" />

</LinearLayout>

2 个答案:

答案 0 :(得分:0)

这取决于您提供的文字,要么在第一个文字的末尾输入,要么使用水平滚动或更改垂直方向。

答案 1 :(得分:0)

在你的第二个textView中使用如下:

XML:

<TextView
                android:gravity="right"
                android:padding="3dip"
                android:text="@string/userprofile_confpsw"
                android:textStyle="bold" />

in values / strings.xml:

<string name="userprofile_confpsw">"Conform New \n Password:"</string>

Conform New将显示在Line-1中,密码显示在第2行。

相关问题