如何格式化一个巨大的textview?

How to format a huge textview?

我想制作一个应用程序,里面有历史,有段落、对话框和标题。如果不在 Strings.xml 中使用 HTML 标签,我该怎么做?有没有一种方法可以在 Activity_main.xml 上仅使用 ScrollView 中的 TextView(因为这是我知道的唯一方法)来格式化它?

所以,如果我必须写一个大文本(比如 20 页),我将不得不使用 HTML?

这是一个例子

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

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textSize="25sp"
        android:textStyle="bold|italic"
        android:text="Title"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="2">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="The point is, that's 20 minutes of your life you'll never get back. And here’s the really sobering statistic: If you want to be 99% certain of getting just one response – just one! – be prepared to send out 114 messages.

That’s one of the reasons OkCupid users exchange about 4 million messages – a day. That's roughly 166,666 messages being sent every hour – one of which was yours. And that’s just one site.

Think of all the Tinder, Bumble, Match.com etc… messages flying around out there. Your message has a lot of competition – especially when you’re messaging the most attractive local women.

No wonder online dating can quickly turn into the most frustrating part-time job you’ll ever have!

Let's assume the initial hurdles standing between you and meeting your ideal partner have been cleared – you've chosen a dating site, written an engaging profile, and selected the perfect profile picture.

You’re ready to skip all that frustration and wasted time, and start using cut  paste messages that will get you real results fast."/>

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Anytime you can find a way to establish common ground, jump on the opportunity. Studies have shown that people are more comfortable around those who remind them of themselves, and if she’s more likely to respond if she feels a bond with you right off the bat.

Connecting over the shared experience of using dating sites is one way to do it. You could also create a message built around cooking, swimming, dancing, reading – whatever subjects you have in common with your target woman.

Some dating sites like Match.com allow you to do keyword searches, so you can filter specifically for women who enjoy a particular hobby."/>
    </LinearLayout>

</LinearLayout>

注意:将您的文本放在 string.xml 中并这样称呼它 android:text="@string/your_text" 而不是直接放置它。