【发布时间】:2011-09-04 17:22:44
【问题描述】:
在我的应用程序中,我使用 ScrollView 来显示图像。 有时,当图像大于视图时,我想显示图像的中心,然后将图像滚动到边缘。 ScrollView 包含一个 ImageView 容器。 怎么做? 谢谢, 艾尔。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout android:id="@+id/relativeLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent">
<ScrollView android:id="@+id/scrollView1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1.0">
<ImageView android:id="@+id/imgImageView"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_gravity="center"/>
</ScrollView>
<TextView android:layout_height="wrap_content"
android:id="@+id/addrTextView"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:gravity="center"
android:textSize="12px"
android:layout_weight="0.0"/>
</RelativeLayout>
</LinearLayout>
【问题讨论】:
标签: android imageview scrollview center