0

我有一个TextView必须显示长文本的地方。它必须显示在 2 行(文本的一部分)上,并且整个文本要显示在“鼠标悬停时”显示的气球中。我进行了搜索,但在 Android 中没有找到任何与此相关的内容。

谁能帮我 ?

提前致谢。

4

2 回答 2

0

我找到了这个例子https://github.com/lorensiuswlt/NewQuickAction3D它解决了我的问题。

于 2013-01-16T11:16:03.553 回答
0

您可以使用子字符串来剪切文本,何时显示以及何时单击显示全部。并在 TextView 中设置 height=wrap_content。

例子:

textView.setText(myString.substring(0,100); //or something like this.

textView.setOnClickListener(new OnClickListener()
    {
        public void onClick(View v) {
            textView.setText(myString);
        }

    });

在xml中:

        <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="" />

我没有检查它,但我认为它会起作用,但要注意布局的大小。

于 2013-01-15T11:10:51.630 回答