是否可以将 TextView
放置在我在代码中计算的某个位置。
我有 x 和 y 位置(计算后得到),我只想将 TextView
放在该位置。
我该如何实现它?
请帮忙。
谢谢,
森
最佳答案
下面的代码可能对您有帮助:
TextView widget = new TextView(screenContext);
widget.setText("Label"+widgetCount);
widget.setLayoutParams(new AbsoluteLayout.LayoutParams(width,height, calculatedX,calculatedY));
这仅在您使用绝对布局时才有效,我假设您正在使用它。
关于android - 如何从代码中定位 TextView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3828345/