我在互联网上搜索了一下如何在我的Android应用程序上将我的背景图像填满,显然它仍然更小。我希望你们知道这个解决方案吗?
我上传的大部分图片都在@mipmap文件夹中,显然我找不到在@drawable文件夹中插入图片的方法。我尝试打开drawable文件夹并复制粘贴图片以将其放入其中但是当它运行时遇到了一些错误。
Error:(12, 25) No resource found that matches the given name (at 'background' with value '@drawable/images').
This a picture of is how it looks like
我还附上了我的内容xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_sad"
tools:context="com.example.chadymaebarinan.emojiexpress.Sad">
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:src="@mipmap/ic_launchersad"
android:gravity="center"
android:id="@+id/imageView"
android:scaleType="fitXY"
android:layout_marginTop="43dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="''I am SAD''"
android:textColor="#FFFF00"
android:textSize="50dp"
android:textStyle="bold"
android:gravity="center"
android:id="@+id/textView4"
android:layout_below="@+id/imageView"
android:layout_alignParentStart="true" />
<ImageButton
android:layout_width="111dp"
android:layout_height="111dp"
android:src="@mipmap/ic_launcherspeak"
android:background="@null"
android:scaleType="fitXY"
android:id="@+id/imageButton"
android:layout_below="@+id/textView4"
android:layout_centerHorizontal="true" />
<ImageButton android:id="@+id/back"
android:layout_width="111dp"
android:layout_height="111dp"
android:src="@mipmap/ic_launcherback"
android:background="@null"
android:scaleType="fitXY"
android:layout_below="@+id/imageButton"
android:layout_alignStart="@+id/imageButton" />
</RelativeLayout>
这是我的活动xml文件:
<?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="com.example.chadymaebarinan.emojiexpress.Sad"
android:background="@drawable/ic_launcherimage">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_sad" />
</android.support.design.widget.CoordinatorLayout>
答案 0 :(得分:3)
将其放入 drawable 文件夹而不是mipmap
。 mipmap文件夹仅用于放置您的应用图标。
答案 1 :(得分:0)
要添加到项目中的图像只需复制该图像,然后右键单击可绘制文件夹并按粘贴。我知道你说你不能这样做但是它对我有用。
一旦它在drawable文件夹中,您可以将其设置为父布局的背景,即LinearLayout等。
mipmap仅用于图标:)
答案 2 :(得分:-1)
将my content.xml文件放入drawable文件夹并使用它。