今天自己写个引导界面的时候,view里面放啦个imageview,然后加入到viewpager里面,发现图片上下总是没有填满。把图片设置为背景又可以填满,经过分析发现应该是图片的的比例与手机的分辨率不符合。
那方法就由2种啦,1:制作9.png 2:拉伸图片 拉伸的属性为scaleType。
还是就是adjustViewBounds属性,但是必须配合Max属性
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView android:src="@drawable/guide1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:contentDescription="lead"/>
</LinearLayout>