[英]Background in Android Studio doesn't work
我正在嘗試將圖像設置為我的應用程序的背景。 我在Android Studio預覽中看到了它,但是如果我在手機(Android 5)上加載該應用程序,則看不到該圖像。 這是代碼。 我是Android世界的新手。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="lorenzobenevento.mydomotics.MainActivity"
android:background="@drawable/background">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
在此先感謝您,我的英語不好。
協調器布局就像框架布局。 您放入的所有內容都將位於之前已定義的小部件之前。
對您而言重要的是,這意味着xml文件中的所有內容:
<include layout="@layout/content_main" />
將位於您在協調器布局中定義的背景圖像的前面。 可能是其中的內容被掩蓋了,因此請考慮在該xml文件中設置背景圖像。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.