How to align the text to top of TextView?

后端 未结 6 765
梦如初夏
梦如初夏 2020-12-04 16:58

How to align the text to top of a TextView?
Equivalent Android API for Swings setInsets()?
that is top of text should start be in (0,0) of TextView



        
6条回答
  •  情书的邮戳
    2020-12-04 17:23

    Im not sure if i understand what you are meaning, but the text inside the textview is going to be align to the top if you use gravity=top on the text-view.

    If you put a backgrund color on you textview you might see better what is happening...

    I guess you problem is that the textview is centered since you use fill_parent on both height and width on the parent LinearLayout. The textview seems to be the only child so try putting gravity=top on the LinearLayout...

    Thats the only thing i could think of...

提交回复
热议问题