gpt4 book ai didi

Android ImageView,adjustViewBounds 在 Android 4.1 中不起作用

转载 作者:太空狗 更新时间:2023-10-29 14:50:54 27 4
gpt4 key购买 nike

在我的实现中,adjustViewBounds=true 在 android 5.1 中完全符合预期但在 4.1 中不做同样的事情

4.1 on left, 5.1 on right

adjustViewBounds=true

enter image description here

adjustViewBounds=false

enter image description here

MainFragment

<GridView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="150dp"
android:numColumns="auto_fit"
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:stretchMode="columnWidth"
tools:context=".MainFragment"
android:id="@+id/movie_gridView">
</GridView>

ImageView

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:id="@+id/gridView_moviePoster"
android:adjustViewBounds="true"/>
</FrameLayout>

最佳答案

If the application targets API level 17 or lower, adjustViewBounds will allow the drawable to shrink the view bounds, but not grow to fill available measured space in all cases. This is for compatibility with legacy MeasureSpec and RelativeLayout behavior.

所以在 Api 级别 17 及以下你必须使用 AdjustableImageView

在gradle下面添加

compile 'com.inthecheesefactory.thecheeselibrary:adjustable-imageview:1.0.0'

详细教程See this

关于Android ImageView,adjustViewBounds 在 Android 4.1 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35450319/

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