Scale scrollview contents to fill screen

时光总嘲笑我的痴心妄想 提交于 2019-12-12 00:49:52

问题


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.


回答1:


 android:scaleType="scaleXY"

in your imageview



来源:https://stackoverflow.com/questions/16289398/scale-scrollview-contents-to-fill-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!