作者:执子之手2502891083 | 来源:互联网 | 2023-08-10 16:03
直接上代码:StringkeywordmData.get(position);TextViewviewnewTextView(UIUtils.getContext());view
直接上代码:
String keyword = mData.get(position);
TextView view = new TextView(UIUtils.getContext());
//view.setTextColor(Color.parseColor("#FF00FF"));
view.setText(keyword);
Random random = new Random();
//随机大小, 16-25
int size = 16 + random.nextInt(10);
view.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
//随机颜色,0-255 ->30 - 230,颜色值不能太小或太大,避免过亮或者过暗(美观
int r = 30 + random.nextInt(200);
int g = 30 + random.nextInt(200);
int b = 30 + random.nextInt(200);
view.setTextColor(Color.rgb(r, g, b));