ImageView scaletype在api 28的代码中不起作用

时间:2019-01-22 14:31:47

标签: android imageview android-imageview scaletype

我的代码在api 28下工作良好:

val im = view?.findViewById(R.id.imageView) as ImageView
val lp_im: ViewGroup.LayoutParams = im.layoutParams 
lp_im.height = height
im.setImageResource(rightAnswer!!.id)
im.requestLayout()

xml:

       <com.makeramen.roundedimageview.RoundedImageView

            android:id="@+id/imageView"
            android:layout_width="0dp"
            android:layout_height="0dp"


            android:layout_marginEnd="4dp"
            android:layout_marginRight="4dp"


            android:padding="8dp"
            android:scaleType="centerCrop"

            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/cv1"
            app:layout_constraintTop_toTopOf="@+id/cv1"


            app:riv_corner_radius_bottom_left="@dimen/card_corner_radius"
            app:riv_corner_radius_bottom_right="@dimen/card_corner_radius"
            app:riv_corner_radius_top_left="@dimen/card_corner_radius"
            app:riv_corner_radius_top_right="@dimen/card_corner_radius" />

但是在api28设备上,刻度无法正常工作,我得到了类似that的信息 有人知道原因吗?

0 个答案:

没有答案