【发布时间】:2015-08-18 17:27:54
【问题描述】:
我正在使用 picasso 将大图像加载到 imageview 中,但我希望它位于视图的中心,但现在它与开始(左上角)对齐,我通过 xml 尝试了alsorts,但没有成功,图像视图在这样的滚动视图和水平滚动视图中
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/scrollcontainer">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/upydownyscrolleyscrolley">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/leftyrightyscrolleyscrolley"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/imagecontainer">
<ImageView
android:id="@+id/wallImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
</HorizontalScrollView>
</RelativeLayout>
有些图像在水平方向上对屏幕来说太大了,有些在垂直方向上太大了,所以我遇到了一种以编程方式实现它的方法,但它不起作用我尝试使用滚动视图的宽度和高度,这不起作用所以我尝试获取像这样的图像视图的高度和宽度,
int centerX = WallpaperView.getWidth()/2;
int centerY = WallpaperView.getHeight()/2;
scrollView.scrollTo(centerX, centerY);
但又不高兴,我不知道这是不是因为毕加索还没有加载视图,虽然我在调用毕加索后调用它有没有人可以帮助我?
【问题讨论】:
标签: android image uiscrollview picasso horizontalscrollview