【发布时间】:2021-05-16 13:14:41
【问题描述】:
我想在活动中显示条款和条件。我想把它们放在 big scrollable textView 但问题是在我的字符串文件中我必须添加标题、段落、链接、不同的字体、字体大小、颜色等 ......我怎么能做到这一点? 此刻,我成功地使用带有多个文本视图和多个字符串的大滚动视图(12000 像素!;)做到了这一点。我怎样才能做得更好?我在android开发方面很糟糕...... 这是我的 xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".controller.CguActivity"
android:background="@color/white">
<RelativeLayout
android:id="@+id/relativeTerms"
android:layout_width="match_parent"
android:layout_height="12000dp">
<TextView //TITLE IN BOLD ITALIC 19SP
android:id="@+id/termsTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="10dp"
android:text="@string/title_terms"
android:gravity="center"
android:fontFamily="@font/custom_font_bold_italic"
android:textColor="@color/lightBlack"
android:textSize="19sp"/>
<TextView // ARTICLE TITLE IN BOLD 17SP
android:id="@+id/article1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/termsTitle"
android:layout_marginTop="30dp"
android:fontFamily="@font/custom_font_bold"
android:text="@string/article1_terms"
android:textColor="@color/lightBlack"
android:textSize="17sp" />
<TextView // PARAGRPAHE 1 IN REGULAR 15 SP
android:id="@+id/para1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/article1"
android:layout_marginTop="10dp"
android:fontFamily="@font/custom_font_regular"
android:text="@string/para1"
android:textColor="@color/lightBlack"
android:textSize="15sp" />
... // LOT OF ARTICLE TITLES, SUBTITLES AND PARAGRAPHS
</RelativeLayout>
</ScrollView>
我不能只放一个链接而不是所有文本。 我有义务根据我所在国家/地区的新法律在滚动视图中书写所有内容,并让用户在滚动所有文本后接受。
【问题讨论】: