【发布时间】:2023-02-10 21:21:27
【问题描述】:
我想以编程方式设置 TextView 的尺寸。但我使用的是 sdp 和 ssp 值。我如何使用这些值以编程方式设置文本视图的尺寸。
TextView tasks = new TextView(this);
tasks.setText(name);
tasks.setTextSize(??);
tasks.setMargin(??)
ViewGroup.LayoutParams l1 = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height??); // what is the height input here?
以及如何设置文本大小(ssp)和边距/填充(sdp)?
【问题讨论】: