0

如果我尝试在其父视图中垂直居中当前视图。我应该使用哪一个?

我看到 TextViews 使用gravity="center_vertical" and ImageViews uselayout_centerVertical="true"。

我不确定为什么?

4

1 回答 1

2

in textview,gravity="center_vertical"表示遗嘱中的内容textviewcenterand vertical。您只能看到textif textviewis fill_parentif it then 的对齐方式,wrap_content那么内容将没有对齐的地方。如果您使用layout_gravityhere 和 width 和 height towrap_content那么它将放置textview在父布局的中心 _vertical 中。

in imageview,layout_centerVertical="true".表示将 iamge 和 in centerandvertical放在图像的父布局中(即图像的容器)。

于 2014-04-03T04:12:34.923 回答