Android Layout 背景图片和颜色

标签 android android-layout

我需要添加什么才能让 main.xml 有背景图像和背景颜色

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="330dp"
android:layout_height="600dp"
android:layout_gravity="center|center_vertical"
android:background="@drawable/background"
>

最佳答案

您应该能够简单地填充父级,然后相应地设置您的背景图片。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
>

关于Android Layout 背景图片和颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16046864/

相关文章:

android - 无法对齐 View

java - Ionic框架安装查询

android - 我可以为 CI 和 Android Studio 设置单独的 gradle.properties 吗?

android - TextView 文本格式导致双倍空间上的最后一个符号删除

Android List + Adapter 仅显示第一个条目

android - 将文本和图像彼此完美对齐

android - 如何让偏好更花哨?

java - 在android中处理多个 View

android - HLS 协议(protocol),ParserException : Failed to parse the playlist, 无法识别任何标签

android - 前景在真实设备中不可见但在模拟器中可见