将超长文本放入 android Activity 时出现问题
Problem on putting Very long text to android Activity
我正在开发一个 Android 应用程序,它将包含一个 activity 文本(+50k 个字符)。
在我添加文本 activity 运行 之前通常没有任何问题,但在我添加它和 运行 activity 之后,应用程序关闭。
你以前解决过这样的问题吗?
您应该将内容添加到 NestedScrollView 中,以便为长内容添加滚动条。
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- YOUR CONTENT HERE-->
</android.support.v4.widget.NestedScrollView>
您的文本太长,您的应用程序在尝试一次显示所有文本时崩溃。正如这篇 article 中所指出的:
"A solution to this is split your text into separate pieces, like paragraphs and put them all into recyclerview with different items."
我正在开发一个 Android 应用程序,它将包含一个 activity 文本(+50k 个字符)。 在我添加文本 activity 运行 之前通常没有任何问题,但在我添加它和 运行 activity 之后,应用程序关闭。
你以前解决过这样的问题吗?
您应该将内容添加到 NestedScrollView 中,以便为长内容添加滚动条。
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- YOUR CONTENT HERE-->
</android.support.v4.widget.NestedScrollView>
您的文本太长,您的应用程序在尝试一次显示所有文本时崩溃。正如这篇 article 中所指出的: "A solution to this is split your text into separate pieces, like paragraphs and put them all into recyclerview with different items."