Win a 3 month subscription to Marco Behler Videos this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Android: set y-coordinate of textview dynamically  RSS feed

Madhu Nandan
Ranch Hand
Posts: 52
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried using textview.setTranslationY(float) to change the y-coordinate of the textview but it does not seem to work. textview.setTop() seems to do the same function but the documentation says this method is meant to be called by the layout system and should not generally be called otherwise, because the property may be changed at any time by the layout. I use textview.getTranslationY() to get the y-coordinate.

How can I set the y-coordinate of textview? If what I am doing above is wrong, kindly suggest an alternative way. Maybe there is another method to set y-coordinate which I have not found yet!

My situation: I have a textview whose height should change based on some value received. If I use textview.setHeight(int), the height increases from top to bottom. I want it to increase from bottom to top. So I change the y-coordinate of the textview every time I set it's height.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!