我想在包含 2 个 TextView 的线性布局中添加背景图像。我是使用框架布局来实现的。但是图像没有根据线性布局的大小进行缩放。任何人都可以帮忙吗?以下是我的布局文件
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/button_update_normal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
</FrameLayout>
最佳答案
您可以通过以下方式设置线性布局的背景
android:background="imagename"
关于android - 在android中设置 ImageView 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19070864/