有没有办法一次更改多个TextView
文字大小?它们可能也可能不是单ViewGroup
。我希望通过创建某种类似于pub / sub但却没有想法的触发器/事件来做。任何可能性?
答案 0 :(得分:0)
You could just use a class which you register the TextViews with. Then have a method which goes through all the registered TextViews and sets the font size. Somethings like:
public class TextViewTextSizer {
private List<TextView> textViews;
public TextViewTextSizer() {
textViews = new ArrayList<>();
}
public void registerTextView(TextView textView) {
textViews.add(textView);
}
public void setTextSize(float size) {
for (TextView textView : textViews) {
textView.setTextSize(size);
}
}
}