这很奇怪,但我非常困惑,因为一个.I需要下载用户资料图片,如下图所示。我有png的外部背景。但我很困惑如何才能做到这一点。如果有人知道更好的和优化的解决方案,请在这里更正。我需要的是,下载的图像将覆盖内白色部分只。

发布于 2016-07-18 18:37:14
在这里,你需要做两件事: circleimageview +背景(蓝色图像)。
如果你想在所有的设备上都得到最好的效果,那就用蓝色图片设置-background,然后根据设备的不同,给Cirlceimageview设置border_width,这样你就可以得到如上所示的图片视图。
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:src="@mipmap/profile" //user profile
android:background="@mipmap/njvkf" //Blue image
app:civ_border_width="4dp"
app:civ_border_color="#31A1DA"/>
</RelativeLayout>添加Cirlceimageview类you can see result of above code snippet
dependencies {
compile 'de.hdodenhof:circleimageview:2.1.0'
}https://stackoverflow.com/questions/38432779
复制相似问题