FrameLayout中的嵌套LinearLayout与父项不匹配

问题描述 投票:0回答:1

我有以下布局,在FrameLayout类中夸大了:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="wrap_content"> 

<ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/img"
        android:layout_gravity="bottom|start"/>

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">
    <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button"/>

</LinearLayout>

嵌套的LinearLayout与指定的父项不匹配,但将其内容包装为按钮的大小,我还尝试将match父项设置为FrameLayout的高度,

这里可能出什么问题了?

android android-framelayout
1个回答
0
投票

将match_parent用于FrameLayout

© www.soinside.com 2019 - 2024. All rights reserved.