我正在創(chuàng)建一個(gè)類(lèi)似于 PokéDex 的應(yīng)用程序。我正在使用 RecyclerViewer 和 Mike Penz 的 FastItemAdapter。我的 Pokemon 類(lèi)中有各種變量,其中兩個(gè)我遇到的問(wèn)題是 String type 和 String weakness。我的目標(biāo)是在 strings.xml 文件中使用 HTML 標(biāo)記來(lái)添加字體顏色。在我的 ModelGenerator 類(lèi)中,我有整個(gè) Pokemon 列表,我從 strings.xml 文件中調(diào)用了相應(yīng)的字符串??诖郑ㄎ覜](méi)有展示 getter 和 setter)package com.example.pokedex;import android.os.Parcel;import android.os.Parcelable;import androidx.annotation.DrawableRes;public class Pokemon implements Parcelable { private final int id; private final String name; private final String type; private final String weakness; private final int drawableResource; private final String description; private final String category; private final String ability; private final String abilityDescription; private final String stats; private final String height; private final String weight; private final String gender; private Pokemon evolution; public Pokemon(int id, String name, String type, String weakness, @DrawableRes int drawableResource, String description, String category, String ability, String abilityDescription, String stats, String height, String weight, String gender) { this.id=id; this.name = name; this.type = type; this.weakness = weakness; this.drawableResource = drawableResource; this.description = description; this.category = category; this.ability = ability; this.abilityDescription = abilityDescription; this.stats = stats; this.height = height; this.weight = weight; this.gender = gender; } } }
如何使用 HTML 標(biāo)記為 strings.xml 文件中的字符串著色?
江戶(hù)川亂折騰
2023-02-16 16:28:44