Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why TextView not center

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to center the my TextView.below is my code.



I have added LayoutParams and Gravity.CENTER; also.but it is not center.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone please help me?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you doing in line 26 and 27?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it sets the TableRow sizes(productionmorning ).
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what do you do on lines 21 to 23? And why do you think I am so interested in the combination of those two groups of lines of code?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Luke wrote:What are you doing in line 26 and 27

sam liyanage wrote:it sets the TableRow sizes(productionmorning ).

No, not really. What really does line 26 do? Line 27 doesn't affect the size of TableRow or the productionmorning object.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually 26 is not used.27 affect the (prodmtext) textview.line 21,22 and 23 for the center the textview value.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens to the LayoutParams you set in line 23 when line 27 gets called, do you think?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is my new code.Still the text value is not center.Steve please help.

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is resolved now.Textview.Gravity is the answer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic