2

I'm a beginner for Android development. I'm making a simple app which displays a TextView with highlighted text. This is my work.

https://i.stack.imgur.com/U5OPe.png (I cannot upload images directly because I'm new to stackoverflow)

But there is a problem in it. It seems that the text is not aligned vertically in line. I want my TextView to display text like the picture below.

https://i.stack.imgur.com/1sUKd.png

This picture is a part of Quote.fm application for iOS. In this application text is aligned vertically in line.

I have searched answers to this question but I only found answers like

 android:layout_gravity="center"   

or

 android:gravity="center_vertical"

and so on. But these are alignment attributes for content itself, aren't these?

Do anybody know how to achieve Quote.fm-like text display?

UPDATE: I think I told something vague. Let me explain it again.

So, I don't want my text(whole text) to be aligned within a TextView. If you see the last lines of two pictures you can tell the difference. First one's text is attached to the top of its line but second one's text isn't. Sorry for my poor English. But this is my best to explain it. T.T

Thanks.

lbyeoksan
  • 123
  • 7

1 Answers1

0

For your TextView, define gravity as:

   android:gravity="center_vertical"

It will work. And "center_vertically" in your question is a typo I think.

Yogesh Somani
  • 2,624
  • 3
  • 21
  • 34
  • Thank you for finding my typo and your answer. But my work is result with android:gravity="center_vertical". I have applied this attribute for long time. I think it aligns while text within a view. – lbyeoksan Feb 04 '13 at 12:58