I have problem with round image, not works, Fresco download the image and display but not transform in a circle. I don't know what I am missing this is my code.
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "pruebas.imaginamos.com.pruebas"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.facebook.fresco:fresco:0.14.1'
testCompile 'junit:junit:4.12'
//compile 'com.mostafagazar:customshapeimageview:1.0.4'
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
compile 'com.facebook.fresco:animated-base-support:0.14.1'
}
This is MainActivity5.java:
package pruebas.imaginamos.com.pruebas;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.facebook.drawee.view.SimpleDraweeView;
public class MainActivity5 extends AppCompatActivity {
SimpleDraweeView simpleDraweeView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String url = "https://firebasestorage.googleapis.com/v0/b/farmatodo-dev.appspot.com/o/imChat%2F2e4120c7-3755-4537-aceb-c2ed9d97ad01%2F1479745196209-about-06.jpg?alt=media&token=fb0c3c8a-eeac-488b-96d2-51bc7cbd088a";
Uri uri = Uri.parse(url);
simpleDraweeView = (SimpleDraweeView) findViewById(R.id.avatarImageView);
simpleDraweeView.setImageURI(uri);
}
}
This is activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:fresco="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="pruebas.imaginamos.com.pruebas.MainActivity5">
<RelativeLayout
android:layout_width="match_parent"
android:background="@color/colorAccentLight"
android:layout_height="wrap_content">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/avatarImageView"
android:layout_width="100dp"
android:layout_height="100dp"
fresco:placeholderImageScaleType="centerCrop"
fresco:placeholderImage="@drawable/photo_female_3"
fresco:roundAsCircle="true"/>
</RelativeLayout>
</LinearLayout>
Replace this line,
xmlns:fresco="http://schemas.android.com/tools"
with this line in your xml file,
xmlns:fresco="http://schemas.android.com/apk/res-auto"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With