Show GIF using Glide in AlertDialog | Sololearn: Learn to code for FREE!
+ 10

Show GIF using Glide in AlertDialog

I want to show GIF using Glide in ImageView, and set this ImageView in AlertDialog. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button_main = (Button)findViewById(; imageView_main = (ImageView)findViewById(; GlideDrawableImageViewTarget imageViewMainTarget = new GlideDrawableImageViewTarget(imageView_main); Glide.with(MainActivity.this).load(R.raw.test).into(imageViewMainTarget); button_main.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ImageView gifImageView = new ImageView(MainActivity.this); GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(gifImageView); Glide.with(MainActivity.this).load(R.raw.test).into(imageViewTarget); AlertDialog.Builder share_dialog = new AlertDialog.Builder(MainActivity.this); share_dialog.setMessage("GIF Test"); share_dialog.setPositiveButton("Done", null); share_dialog.setView(gifImageView);; } }); } GIF can only display in imageView_main, it can't be shown on AlertDialog's gifImageView ! Why ?

23rd Sep 2017, 4:05 AM
Corey - avatar
3 ответов
+ 1
Do this: Use gifImageView library. Make custom dialog using DialogFragment Use Glide to show gif in gifImageView
15th Nov 2017, 6:19 PM
SkillsOn - avatar
28th Dec 2017, 9:25 AM
Taabeer Murtaza
Taabeer Murtaza - avatar
+ 2
Alert Dialoges are used to show a small amount of text, they support no fonts, images, or any tags at all.
23rd Sep 2017, 7:41 PM
Eldar Bakerman