【发布时间】:2013-08-17 10:56:00
【问题描述】:
我试图在水平滚动视图内的线性布局内获得 2 个(或更多)图像视图,这样每个图像都被缩放以适应屏幕高度而不扭曲图像,即一个图像在屏幕上显示尽可能大,滚动查看下一个。
添加第二张图片后,我会得到 2 张彼此相邻的小图片(两张图片的尺寸均为 217 * 300 像素)。目前我的 activity_main.xml 如下所示..
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/image1"
android:src="@drawable/luke"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
/>
<ImageView
android:id="@+id/image2"
android:src="@drawable/luke"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
/>
</LinearLayout>
</HorizontalScrollView>
</FrameLayout>
我在布局上尝试了 match_parent、fill_parent、wrap_content 的各种组合,图像视图上的所有 scaleTypes 并花了一天时间浏览网络寻找与我想要的类似的示例,但没有运气。
【问题讨论】:
标签: android imageview android-linearlayout fullscreen horizontalscrollview