LDropl
LDropl

Reputation: 944

Change text color in RecyclerView

I have a RecyclerView with list of users, where in UI shows username of each user.

The text color is per default is black and I would like to change it to another color. There is no property for textColor so I guess it should be done programmatically

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/users"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="6"
            android:background="@color/textFieldBackground"
            />

here is my element:

        users = findViewById(R.id.users);
        users.addItemDecoration(new DividerItemDecoration(users.getContext(), DividerItemDecoration.VERTICAL));

Upvotes: 0

Views: 305

Answers (1)

Justin
Justin

Reputation: 36

Normally your recyclerView contains an adapter. The adapter holds/binds a list of UI elements (your users). So in my opinion, you have to change the colour of the user elements in your custom adapter class

Upvotes: 2

Related Questions