gpt4 book ai didi

Horizo​​ntalScrollView 中的 Android ImageView 获取屏幕宽度的两倍

转载 作者:行者123 更新时间:2023-11-29 15:27:22 26 4
gpt4 key购买 nike

我试图在 Horizo​​ntalScrollView 中制作一个 ImageView,但是 imageView 的宽度是屏幕的两倍,并且在中途结束时超出了边界。

我的 XML:

<?xml version="1.0" encoding="utf-8"?>

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >


<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:baselineAligned="true"
android:orientation="vertical" >

<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/penguins" />
</LinearLayout>

</HorizontalScrollView>

And a image of what I get (click me!)

有谁知道这个问题的解决方案吗?

问候

最佳答案

我复制了你的 xml 并使用我的资源,它看起来很完美,我相信你的资源比你想象的要大,你可能应该使用 layout_widthlayout_height 作为修复大小并将 scaleType 设置为 centerInside。

关于Horizo​​ntalScrollView 中的 Android ImageView 获取屏幕宽度的两倍,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10609289/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com