TextView gravity

后端 未结 1 1604
余生分开走
余生分开走 2021-01-17 11:45

Has anyone tried to write his own implementation of ViewGroup with some TextViews in it?

I have a problem, that TextViews in such an implementation don\'t r

1条回答
  •  说谎
    说谎 (楼主)
    2021-01-17 12:24

    This is not the wrong behavior you are just trying to set the wrong property.

    With TextView.setGravity(Gravity.CENTER) you are setting the gravity of the TextView's content.

    What you are looking for is the layout_gravity.

    0 讨论(0)
提交回复
热议问题