I'm testing the glide for loading the images in my project.
I created the following layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imageview"
android:background="#550000ff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
When I load the image with the imageView.setImageResource(int)
it loads correctly (see screenshot below)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView= (ImageView) findViewById(R.id.imageview);
imageView.setImageResource(R.drawable.pen_logo);
}
But when I load it with glide the image get expanded ignoring the wrap_content layout params:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView = (ImageView) findViewById(R.id.imageview);
Glide.with(this).load(R.drawable.pen_logo).into(imageView);
}
How can I solve this problem?