hurriedly% 2010-08-14 09:28 采纳率: 100%
浏览 381
已采纳

重力与布局重力在 Android 上的差异

I know we can set the following values to the android:gravity and android:layout_gravity properties:

  1. center
  2. center_vertical
  3. center_horizontal, etc.

But I am confused regarding both of these.

What is the difference between the usage of android:gravity and android:layout_gravity?

转载于:https://stackoverflow.com/questions/3482742/difference-between-gravity-and-layout-gravity-on-android

  • 写回答

19条回答 默认 最新

  • YaoRaoLov 2010-08-14 09:31
    关注

    Their names should help you:

    • android:gravity sets the gravity of the contents (i.e. it's subviews) of the View it's used on.
    • android:layout_gravity sets the gravity of the View or Layout relative to its parent.

    And an example is here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(18条)

报告相同问题?

悬赏问题

  • ¥100 有偿,谁有移远的EC200S固件和最新的Qflsh工具。
  • ¥15 找一个QT页面+目标识别(行人检测)的开源项目
  • ¥15 有没有整苹果智能分拣线上图像数据
  • ¥20 有没有人会这个东西的
  • ¥15 cfx考虑调整“enforce system memory limit”参数的设置
  • ¥30 航迹分离,航迹增强,误差分析
  • ¥15 Chrome Manifest扩展引用Ajax-hook库拦截请求失败
  • ¥15 用Ros中的Topic通讯方式控制小乌龟的速度,走矩形;编写订阅器代码
  • ¥15 LLM accuracy检测
  • ¥15 pycharm添加远程解释器报错