Below is the part of the code I am using to convert the imageurl into imageView using Glide.
@Resolve
private void onResolved() {
titleTxt.setText(mInfo.getTitle());
captionTxt.setText(mInfo.getCaption());
timeTxt.setText(mInfo.getTime());
Glide.with(mContext).load(mInfo.getImageUrl()).into(imageView);
Below is the json file I am using
{
"title": "Livery Hunting At The Festival Of Speed",
"image_url": "http://speedhunters-wp-production.s3.amazonaws.com/wp-content/uploads/2017/07/14045435/goodwood-festivalofspeed-jordanbutters-speedhunters-1652-1200x801.jpg",
"caption": "The Goodwood Festival of Speed boasts vehicular variety like few other annual gatherings.",
"time": "13 hours ago"
}
Below I've added my XML for what Im trying to achieve
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:paddingBottom="20dp"
android:gravity="left"
android:background="@drawable/bottom_border_on_light">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:cardCornerRadius="4dp"
app:cardElevation="1dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="60dp"
android:layout_height="80dp"
android:layout_gravity="top"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/titleTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="16sp"
android:typeface="sans"
android:textStyle="normal"/>
<TextView
android:id="@+id/captionTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textColor="@color/white"
android:textSize="12sp"
android:typeface="sans"
android:textStyle="normal"/>
<TextView
android:id="@+id/timeTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="right"
android:textColor="@color/white"
android:textSize="12sp"
android:typeface="sans"
android:textStyle="normal"/>
</LinearLayout>
</LinearLayout>
In terms of resizing do I have to resize it in my java classes or resize it by using my XML layout file.
Glide.with(mContext).load(mInfo.getImageUrl()).override(100,100).into(imageView);