增加RecyclerView项目的字体大小

时间:2018-10-04 06:47:20

标签: 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>

1 个答案:

答案 0 :(得分:0)

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

相关问题