在Android Studio活动中显示条款和条件



我希望在活动中显示条款和条件。我想把它们放在大的可滚动文本视图中,但问题是在我的字符串文件中,我必须添加标题、段落、链接、不同字体、字体大小、颜色等。。。我该怎么做?此时此刻,我成功地使用了一个具有多个文本视图和多个字符串的大滚动视图(12000px!;(。我怎样才能做得更好?我不擅长安卓开发。。。这是我的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>

我不能只放一个链接而不是所有的文本根据我所在国家的新法律,我有义务在滚动视图中写入所有内容,并在用户滚动所有文本后让他接受。

在中最好使用wrap_content而不是12000dp

<RelativeLayout
android:id="@+id/relativeTerms"
android:layout_width="match_parent"
android:layout_height="wrap_content">

您可以将字符串格式化为HTML格式,并将其显示在WebView中,如下所示。你也可以将它们上传到你的网页,并以这种方式在你的应用程序中显示整个网页。

最新更新