gpt4 book ai didi

android - 改变 LinearLayout 的背景会改变它的宽度和高度

转载 作者:行者123 更新时间:2023-11-29 17:46:01 39 4
gpt4 key购买 nike

我试图将 LinearLayout 的背景更改为某种木质纹理,但它会根据木质背景的尺寸改变 LinearLayout 的宽度和高度!我需要 LinearLayout 来忽略背景尺寸!

<LinearLayout
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/wood"
android:orientation="vertical" >

some content here which I need to wrap height to them!

</LinearLayout>

最佳答案

您的LinearLayout 的 高度是"wrap_content"。这意味着它需要内容的高度(你的背景)。您可以将其更改为 "match_parent" 或在 dp 中为其指定固定大小。这样即使有背景也能保持不变。

关于android - 改变 LinearLayout 的背景会改变它的宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26687522/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com