Фрагмент главной страницы содержит обзор переработчика. Для каждого элемента recyclerView открывается новый фрагмент.
![enter image description here](https://i.stack.imgur.com/tE0Dl.png)
Два самых верхних фрагмента содержат много текста.
Первый использует TextViews -
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:context=".FirstFragment"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Unit 1"
android:textAlignment="center"
android:textSize="24sp"
android:textStyle="bold"
android:layout_marginTop="10dp"
android:textColor="@color/whiteColor"
android:background="@color/blackColor"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_one"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Unit 2"
android:textAlignment="center"
android:textSize="24sp"
android:textStyle="bold"
android:layout_marginTop="10dp"
android:textColor="@color/whiteColor"
android:background="@color/blackColor"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_two"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Unit 3"
android:textAlignment="center"
android:textSize="24sp"
android:textStyle="bold"
android:layout_marginTop="10dp"
android:textColor="@color/whiteColor"
android:background="@color/blackColor"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_three"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Unit 4"
android:textAlignment="center"
android:textSize="24sp"
android:textStyle="bold"
android:layout_marginTop="10dp"
android:textColor="@color/whiteColor"
android:background="@color/blackColor"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_four"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_five"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_six"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_seven"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_eight"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_nine"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_ten"
android:textIsSelectable="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:autoSizeTextType="uniform"
android:fontFamily="serif"
android:text="@string/pink_eleven"
android:textIsSelectable="true"/>
</LinearLayout>
</ScrollView>
Второй использует файл webView -
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SecondFragment">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Я думал, что использование webView даст лучшую производительность, но это также медленно (но лучше, чем множество textViews).
Полагаю, первый занимает около 4-5 секунд, а второй 3-4 секунды. Я не хочу, чтобы это было так медленно.
Что может быть наиболее эффективным способом сделать это?
Обновление: Я решил использовать WebViews. Почему после первого открытия моего приложения только WebView будет загружаться медленно, после этого он или любой другой WebView будет загружаться быстро?