如图,导入的资源是选择的新建Image asset->launch icon下的image,图片类型是jpeg(哪怕是png问题也一样),以下是LinearLayout中的属性
android:layout_height="match_parent"
android:layout_width="match_parent"
android:baselineAligned="false"
android:orientation="vertical"
android:background="@mipmap/ic_aa"
如果是导入的图片,还会模糊掉,但是如果是直接复制进去的图片却比较清晰。
感觉遇到了人生的瓶颈,跪求解答。
试了用XML解决的办法,边缘还是透白。
我试了试第二个Image的方法,在LinearLayout下只放一个<ImageView>
图片是系统的图标,但是也是空白了。
我后面又试了试,在drawable下面的图标,大概是可以铺满屏幕的,但是如果想要导入一个图片,它下面的缩略图什么的又都变成了灰色的,拿着导入的灰色图片添加背景,还是四周空白,是不是我图片不太对啊?
貌似系统自带的图标和我去别的地方下载的图标都可以铺满,只要是自己加的图片都这么惨,跪求一个可以的图片拿来试试看啊。或者哪里下载可用图片也行。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_login"
android:layout_height="match_parent"
android:layout_width="match_parent"
tools:context="com.android.mobilepay.mobilepay.LoginActivity"
android:orientation="vertical"
android:background="@drawable/ic_action_h"
>
</LinearLayout>
按照采纳的答案我认真看了下用于导入的资源,它的边缘有一层透明的边缘,直接复制粘贴进去的资源边缘是没有这一层透明的,所以,正解就是资源没搞好。TT ^TT
I think you made a mistake somewhere. The background of the view is stretched to full screen by default. Please add more code
--------------------- -----------------------Separating line----------------------- -------------
This is a resource file problem, that is to say, it is not that the picture cannot be full screen, but that your picture itself has padding. You can go into the directory to view your drawable resources. , there should be padding.
The source file itself may not have padding, but the way you added it is wrong. The way to import drawable resources is to directly put them into directories such as xxxdpi-drawable instead of using ImageAsset. This tool selects the generated category. At that time we can see that it is used to generate startup icons, ActionBar icons, notification icons and the like. For some categories, such as ActionBar icons, it will force adding padding.
Portal:
Bitmap XML and BitmapDrawable application examples
Drawable Resource - XML Bitmap
Use ImageView instead,
scaleType Try several parameters and find one you are satisfied with.
Use BitmapDrawable, set src to the image, set the gravity of BitmapDrawable to "fill_verical|fill_horizonal", and then set the LinearLayout background to this bitmap