ben*_*nvd 4 scaling android imageview
我正在尝试在ImageView中绘制图像,但我希望它不需要缩放,必要时使用滚动条.我怎么能做到这一点?现在我只有一个drawable set作为XML中ImageView的android:src.这会自动缩放图像以适应屏幕宽度.
我读到这可能是因为兼容模式(开发1.5,测试2.1),但后来我补充说
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
Run Code Online (Sandbox Code Playgroud)
我的清单,没有任何改变.
有线索吗?
-
编辑:我android:scaleType="center"在ImageView上使用,这显示完整的图像(不能相信我之前没有看到过),但我仍然只得到一个垂直滚动条.使用android:scrollbars="horizontal"围绕ImageView的ScrollView(显然)隐藏垂直滚动条,但不显示水平滚动条...
这对我有用(在ScrollView中使用HorizontalScrollView):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imagen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
/>
</HorizontalScrollView>
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)