glide 4.7.1 加载gif
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:gravity="center"
android:layout_gravity="center"
android:background="#f9f9f9"
android:layout_width="match_parent"
android:layout_height="50dp">
<FrameLayout
android:backgroundTint="#fe461c"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_gravity="center">
<ImageView
android:id="@+id/pulling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
/>
<ImageView
android:id="@+id/pullok"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="30dp"
android:layout_height="30dp"
/>
<ImageView
android:id="@+id/pullrelease"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="30dp"
android:layout_height="30dp"
/>
</FrameLayout>
</LinearLayout>
private void initView(ReactContext context) {
this.reactContext = context;
header = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.header,null);
pulling = header.findViewById(R.id.pulling);
pullok = header.findViewById(R.id.pullok);
pullrelease = header.findViewById(R.id.pullrelease);
Glide.with(context).asGif().load(R.mipmap.pullrelease).into(pulling); //不能显示
Glide.with(context).asGif().load(R.mipmap.pullrelease).into(pullrelease); //不能显示
pullok.setImageResource(R.mipmap.pullok); //能显示
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
params.gravity= Gravity.CENTER;
this.addView(header,params);
}