eya*_*yal 6 android scroll resize image android-imageview
我希望在不调整图像大小的情况下显示尺寸大于设备屏幕的图像.它必须以屏幕为中心.我怎样才能做到这一点?
使用带有图像视图的scrollview并设置该滚动视图的高度
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/accountIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
我注意到我需要使用普通(垂直)和水平 ScrollView 才能双向滚动。如果还有其他方法,请告诉我。
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView" >
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/horizontalScrollView">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/imageView3"
android:src="@drawable/big_map"/>
</HorizontalScrollView>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
它从图像的左上角开始显示。如果我尝试使用 android:layout_gravity="center" 那么我会在右侧或底部看到白色部分。所以居中对我来说不起作用。
选项2:使用WebView控件,并在onCreate时使用图像加载它。
| 归档时间: |
|
| 查看次数: |
5104 次 |
| 最近记录: |