增加 RecyclerView 项目的字体大小

use*_*911 6 java android android-recyclerview

我有一个导航栏,其中RecyclerView有不同的项目。我想改变它的字体大小。这是代码navigation_menu.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/app_background"
    android:textSize="30sp"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <include layout="@layout/nav_header_main" />

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerView_main"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginStart="5dp"
            android:layout_marginTop="5dp" />

    </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

Eup*_*ial 1

我想到的第一个也是最简单的方法是直接在单个项目中更改字体大小。但如果由于某种原因您不想这样做,请尝试阅读以下内容:Android 从 Activity 更改 RecyclerView 适配器上的 TextView textSize