@Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            ViewGroup.LayoutParams layoutParams = mImageView.getLayoutParams();
            layoutParams.height = layoutParams.width * (isChecked ? 2 : 1);
            mImageView.setLayoutParams(layoutParams);
          }
GIF example that illustrates how to display a simple GIF file
samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imageformat/gif/ImageFormatGifFragment.java