滚动视图缩放内容来填充屏幕 [英] Scale scrollview contents to fill screen

查看:223
本文介绍了滚动视图缩放内容来填充屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示几个位imageviews来填充屏幕滚动型。为了支持更大的屏幕,我只是想缩放图像。如果我把一个单一的ImageView在滚动视图,它进行缩放以适合(FILL_PARENT)。然而,添加第二个imageview的下导致imageviews恢复到实际大小,而不是被放大后以填充屏幕。


 <的LinearLayout
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:背景=@绘制/ menu_ground
    机器人:方向=垂直>    < ImageView的
        机器人:ID =@ + ID / imageView1
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:SRC =@绘制/图片1/>    < ImageView的
        机器人:ID =@ + ID / ImageView2
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:SRC =@绘制/图片2/>    < ImageView的
        机器人:ID =@ + ID / ImageView3
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:SRC =@绘制/图片3/>    < ImageView的
        机器人:ID =@ + ID / ImageView3
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:SRC =@绘制/图片4/>
< / LinearLayout中>

图像位于绘制文件夹,没有dpi的。


解决方案

 的android:scaleType =scaleXY

在您的ImageView

I've a scrollview that displays a few bitmap imageviews to fill the screen. To support larger screens, I just want to scale the images. If I place a single imageview in the scrollview, it scales to fit (fill_parent). However, adding a second imageview underneath causes the imageviews to revert to actual size and not be upscaled to fill the screen.

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/menu_ground"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/picture1" />

    <ImageView
        android:id="@+id/ImageView2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/picture2" />

    <ImageView
        android:id="@+id/ImageView3"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/picture3" />

    <ImageView
        android:id="@+id/ImageView3"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/picture4" />
</LinearLayout>

The images are located in the "drawable" folder, no dpi.

解决方案

 android:scaleType="scaleXY"

in your imageview

这篇关于滚动视图缩放内容来填充屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆