有框架布局,其中width \ height = wrap_content。但是,当我尝试设置背景时,它会增加到最大尺寸,即使它不包含任何元素。如何修复它?wrap_content不适用于背景
<FrameLayout
xmlns:android="schemas.android.com/apk/res/android";
xmlns:app="schemas.android.com/apk/res-auto";
android:background="@drawable/oblakol"
adroid:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true" >
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</FrameLayout>
当您将其设置为wrap_content时,它会占用完整大小的背景图像。 FrameLayout的大小取决于背景图像的大小。 – Furqan