Add Library To FresCo
compile 'com.facebook.fresco:fresco:1.5.0'
FrescoActivity.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.bhaumik.networkingtask.FreshcoActivity">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/simple_draweeView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
FrescoActivity.java
package com.example.bhaumik.networkingtask;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.view.SimpleDraweeView;
public class FreshcoActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fresco.initialize(this);
setContentView(R.layout.activity_freshco);
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) findViewById(R.id.simple_draweeView);
Uri uri = Uri.parse("https://tinypng.com/images/social/developer-api.jpg");
simpleDraweeView.setImageURI(uri);
}
}
0 comments:
Post a Comment