展会信息港展会大全

代码片段 如何使用支持gif的image...
来源:互联网   发布日期:2016-01-14 11:29:31   浏览:2015次  

导读:pl.droidsonroids.gif.GifImageView android:layout_width=match_parent android:layout_height=match_parent android:src=@drawable/src_anim android:background=@drawable/bg_anim / dependencies { compile 'pl.droidsonroids.gif:android-gif-drawable:...

<pl.droidsonroids.gif.GifImageView

android:layout_width="match_parent"

android:layout_height="match_parent"

android:src="@drawable/src_anim"

android:background="@drawable/bg_anim"

/>

dependencies {

compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'

}

@Override

protected void onCreate ( Bundle savedInstanceState )

{

super.onCreate( savedInstanceState );

GifImageButton gib = new GifImageButton( this );

setContentView( gib );

gib.setImageResource( R.drawable.sample );

final MediaController mc = new MediaController( this );

mc.setMediaPlayer( ( GifDrawable ) gib.getDrawable() );

mc.setAnchorView( gib );

gib.setOnClickListener( new OnClickListener()

{

@Override

public void onClick ( View v )

{

mc.show();

}

} );

}

赞助本站

人工智能实验室

相关热词: android开发 android教程

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港