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(R.id.button_main); imageView_main = (ImageView)findViewById(R.id.imageView_main); 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); share_dialog.show(); } }); } GIF can only display in imageView_main, it can't be shown on AlertDialog's gifImageView ! Why ? https://stackoverflow.com/questions/46366287/show-gif-using-glide-in-alertdialog

23rd Sep 2017, 4:05 AM
Corey
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
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