简体   繁体   English

如何通过Java代码更改TextView的位置?

[英]How can i change the position of a TextView through Java code?

I want to change the position of A textView (in Java code, in Attribution to X and Y), After animating this view. 在为该视图设置动画之后,我想更改A textView的位置(在Java代码中,归因于X和Y)。

Software : Android Studio . 软体:Android Studio。

Layout : Constraint Layout . 布局:约束布局。

How can i do this? 我怎样才能做到这一点?

Let's say 'mytext' is your textView, then: 假设“ mytext”是您的textView,然后:

TextView thetext = findViewById(R.id.mytext);

thetext.setX(115 or whatever your X position is);
thetext.setY(325 or whatever your Y position is);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM