【问题标题】:How to set an xml image resizing to its parent's height如何将 xml 图像调整为其父级的高度
【发布时间】:2021-10-28 04:18:41
【问题描述】:

我正在做一个需要使用图像的应用程序,但 Horizo​​ntalScrollView 上的 ImageView 没有调整到其父级的高度。怎么做?我尝试了所有方法,例如 centerCrop、ScaleType 等……但没有任何效果


        <HorizontalScrollView
            android:layout_width="fill_parent"
            android:orientation="horizontal"
            android:layout_height="@dimen/scrollShareImgHeight">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/sharedLinearLayoutImgs"
                android:orientation="horizontal">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop"
                    android:adjustViewBounds="true"
                    android:src="@drawable/loremipsum"/>


            </LinearLayout>

        </HorizontalScrollView>

【问题讨论】:

    标签: android xml imageview


    【解决方案1】:

    保持线性布局的高度为“match_parent”。

    【讨论】:

    • 啊是的,我会尝试抱歉,没有看到像我们在法语中所说的那样
    • 就是这样!非常感谢
    猜你喜欢
    • 1970-01-01
    • 2012-09-23
    • 1970-01-01
    • 2019-05-08
    • 2021-02-14
    • 1970-01-01
    • 2021-01-14
    • 2018-09-10
    • 2021-07-16
    相关资源
    最近更新 更多