Last active
April 14, 2018 11:47
-
-
Save pastcompute/ee9de32c5abc026928d39707e58407d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
GifDrawable gif = new GifDrawable( cordova.getActivity().getAssets(), "platfarm.gif" ); | |
GifImageView imageView = new GifImageView(webView.getContext()); | |
imageView.setImageDrawable(gif); | |
imageView.setScaleType(ImageView.ScaleType.FIT_XY); | |
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); | |
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); | |
float density = webView.getContext().getResources().getDisplayMetrics().density; | |
layoutParams.width = Math.round(230 * density); | |
layoutParams.height = Math.round(230 * density); | |
imageView.setLayoutParams(layoutParams); | |
centeredLayout.addView(imageView); | |
gif.setSpeed(1); | |
gif.start(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment