JIANGzihao0222

导航

 

wrap_content:是layout_width和layout_height的属性值之一,表示和自身内容一样的长度。

match_parent:是layout_width和layout_height的属性值之一,表示和父组件一样的长度。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"//垂直
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:layout_width="wrap_content"//写的内容规定大小
android:layout_height="wrap_content"//写的内容规定大小
android:text="大小" />

<Button
        android:text="大小大小"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="大小大小"
android:layout_width="match_parent" //父类大小
android:layout_height="wrap_content"/>
    <Button
android:text="大小大小"
android:layout_width="match_parent"//父类大小
android:layout_height="match_parent"//父类大小
/>
</LinearLayout>

 

posted on 2023-02-26 21:04  实名吓我一跳  阅读(16)  评论(0编辑  收藏  举报