微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android 布局参数:wrap_content 与 match_content

wrap_content

wrap_content指示您的视图将其大小调整为内容所需的尺寸。

<EditText
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:background="@color/purple_200"
  android:hint="请输入内容" />

EditText 控件高度和宽度随着字节的内容而变化。

image

match_parent

match_parent指示您的视图尽可能采用其父视图组所允许的最大尺寸。

<EditText
  android:layout_width="wrap_content"
  android:layout_height="match_parent"
  android:background="@color/purple_200"
  android:hint="请输入内容" />

EditText 控件高度和宽度随父视图而变化。

image

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐