Display Animated GIF

后端 未结 30 2081
无人及你
无人及你 2020-11-22 02:11

I want to display animated GIF images in my aplication. As I found out the hard way Android doesn\'t support animated GIF natively.

However it can display animations

30条回答
  •  情话喂你
    2020-11-22 02:46

    Try this, bellow code display gif file in progressbar

    loading_activity.xml(in Layout folder)

    
    
        
    
    
    

    custom_loading.xml(in drawable folder)

    here i put black_gif.gif(in drawable folder), you can put your own gif here

    
    
    

    LoadingActivity.java(in res folder)

    public class LoadingActivity extends Activity {
    
        ProgressBar bar;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_loading);
            bar = (ProgressBar) findViewById(R.id.progressBar);
            bar.setVisibility(View.VISIBLE);
    
        }
    
    }
    

提交回复
热议问题