如何解决android ScrollView指向视图的中心
| 在我的应用程序中,我正在使用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>
解决方法
在ImageView中
android:layout_centerInParent=\"true\"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。