gpt4 book ai didi

java - 在不影响布局大小的情况下在Linearlayout上设置背景png

转载 作者:行者123 更新时间:2023-11-29 08:27:14 25 4
gpt4 key购买 nike

背景图像不填充线性布局并更改其大小

  <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@mipmap/dashboard_background"
android:orientation="vertical"
android:padding="10dp">

enter image description here

理想的样子是这样的

enter image description here

我怎样才能做到这一点?

最佳答案

你应该使用带有 ImageView 和内部线性布局的框架布局

<FrameLayout
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/background"/>

<LinearLayout
---Your Layout---
</LinearLayout>

关于java - 在不影响布局大小的情况下在Linearlayout上设置背景png,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51616004/

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