【问题标题】:match_parent within wrap_content layoutwrap_content 布局中的 match_parent
【发布时间】:2014-04-09 15:13:57
【问题描述】:

我正在尝试查找有关 UI 组件行为的文档或指南,其中 layout_width/layout_height 设置为 match_parent,位于 wrap_content 的 layout_width/layout_height 的 ViewHolder 中。

例如,以下布局的预期结果是什么?

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#000000"
     />
     </RelativeLayout>

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    根据here 的描述,您示例的布局将取决于您在 LinearLayout 中放置的内容。该内容将扩展以填充父 RelativeLayout 中的所有可用垂直空间。默认情况下,LinearLayout 将位于父级 RelativeLayout 的左上角

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-14
      • 1970-01-01
      • 2017-04-03
      • 2017-11-27
      • 1970-01-01
      • 2017-07-04
      • 2015-04-02
      相关资源
      最近更新 更多