Android 加载图像时滑动圆角
我需要将Android 加载图像时滑动圆角,android,imageview,android-glide,Android,Imageview,Android Glide,我需要将byte[]转换为位图,并将其放入ImageView中。 我见过Glide这样做,所以我在onBindViewHolder()中实现了这段代码: 这是单个cardView的布局: 尝试如下设置背景: <android.support.v7.widget.CardView android:id="@+id/card_view" android:layout_width="170dp" a
byte[]
转换为位图,并将其放入ImageView
中。
我见过Glide这样做,所以我在onBindViewHolder()中实现了这段代码:
这是单个cardView的布局:
尝试如下设置背景:
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="170dp"
android:layout_height="170dp"
android:background="#fff"
......
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/aircraft"
android:id="@+id/pic"
android:background="#fff"
.....
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
您是否尝试将CardView或ImageView的背景色设置为透明?尝试使用fitCenter()-->而不是centerCrop()...Glide.with(context).load(url).fitCenter().placeholder(R.drawable.default_image).into(img);两种解决方案都试过了,但都不能解决问题你明白了吗?我也有同样的问题。@r3dm4n我找不到这个问题的解决方案
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="170dp"
android:layout_height="170dp"
android:background="#fff"
......
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/aircraft"
android:id="@+id/pic"
android:background="#fff"
.....
/>
</RelativeLayout>
</android.support.v7.widget.CardView>