Skip to content

Commit

Permalink
Merge pull request facebook#28 from ersin-ertan/patch-1
Browse files Browse the repository at this point in the history
update 00-index for explicitness
  • Loading branch information
tyronen committed Mar 29, 2015
2 parents 8a54ead + 70e72e7 commit d8d8583
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions docs/00-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ next: concepts.html

If you just want to download an image and display it, showing a placeholder until it comes, use a [SimpleDraweeView](../javadoc/reference/com/facebook/drawee/view/SimpleDraweeView.html).

Near your application startup, initialize the classes:
Near your application startup and before ```setContentView()```, initialize the Fresco class:

```java
Fresco.initialize(context);
Expand All @@ -21,28 +21,34 @@ In your XML, add a custom namespace to the top-level element:
<!-- Any valid element will do here -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto">
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">
```

Then add the view itself:
Then add the ```SimpleDraweeView``` to the layout:

```xml
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/my_image_view"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="130dp"
android:layout_height="130dp"
fresco:placeholderImage="@drawable/my_drawable"
/>
```

To show an image, you need only do this:

```java
draweeView.setImageURI("http://site.com/uri");
SimpleDraweeView draweeView = (SimpleDraweeView)findViewById(R.id.my_image_view);
draweeView.setImageURI("http://frescolib.org/static/fresco-logo.png");
```

and Fresco does the rest.

The placeholder is shown until the image is ready. The image will be downloaded, cached, displayed, and cleared from memory when your view goes off-screen.
add Android's internet permission to the AndroidManifest.xml
```xml
<uses-permission android:name="android.permission.INTERNET"/>
```

and Fresco does the rest.

The placeholder is shown until the image is ready. The image will be downloaded, cached, displayed, and cleared from memory when your view goes off-screen.

0 comments on commit d8d8583

Please sign in to comment.