1
0
mirror of https://github.com/wasabeef/glide-transformations.git synced 2025-06-29 12:52:47 +08:00

add sample name

This commit is contained in:
wasabeef 2015-01-12 00:51:22 +09:00
parent ae6a3d0114
commit b7a32e2b7a
2 changed files with 18 additions and 2 deletions

View File

@ -4,6 +4,8 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import org.w3c.dom.Text;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
@ -12,6 +14,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
@ -84,6 +87,7 @@ public class MainAdapter extends RecyclerView.Adapter<MainAdapter.ViewHolder> {
Glide.with(mContext).load(R.drawable.demo)
.bitmapTransform(transformation).into(holder.image);
holder.title.setText(mDataSet.get(position).name());
}
@Override
@ -94,10 +98,12 @@ public class MainAdapter extends RecyclerView.Adapter<MainAdapter.ViewHolder> {
static class ViewHolder extends RecyclerView.ViewHolder {
public ImageView image;
public TextView title;
ViewHolder(View itemView) {
super(itemView);
image = (ImageView) itemView.findViewById(R.id.image);
title = (TextView) itemView.findViewById(R.id.title);
}
}
}

View File

@ -6,9 +6,19 @@
<ImageView
android:id="@+id/image"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"/>
android:layout_centerInParent="true"
android:contentDescription="@null"
android:src="@drawable/demo"/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textColor="@android:color/white"/>
</RelativeLayout>