【问题标题】:Is there a difference between android:layout_centerVertical and android:layout_gravity="center_vertical"? [duplicate]android:layout_centerVertical 和 android:layout_gravity="center_vertical" 有区别吗? [复制]
【发布时间】:2015-02-04 00:56:18
【问题描述】:

我想标题说明了一切。这两个(如果有的话)XML 属性有什么区别?什么时候可以更好地使用另一个?

...
android:layout_gravity="center_vertical"
...

...
android:layout_centerVertical="true"
...

【问题讨论】:

    标签: android xml layout gravity


    【解决方案1】:

    好吧,layout_centerVertical 只对RelativeLayouts 有效。重力也适用于线性布局,因此您可以告诉水平方向的 LL 将对象垂直居中,否则会顶部或底部对齐。

    【讨论】:

      猜你喜欢
      • 2013-04-01
      • 2013-07-27
      • 2013-12-02
      • 1970-01-01
      • 1970-01-01
      • 2013-05-28
      • 1970-01-01
      • 1970-01-01
      • 2014-09-24
      相关资源
      最近更新 更多