你好,游客 登录 注册 搜索
背景:
阅读新闻

Android自定义带倒影和偏转的超炫Gallery

[日期:2012-06-18] 来源:Linux社区  作者:aomandeshangxiao [字体:大 中 小]

Android自定义带倒影和偏转的超炫Gallery,先看下效果图:

看下主类代码:

  1. public class GalleryDemoActivity extends Activity {  
  2.     /** Called when the activity is first created. */  
  3.     @Override  
  4.     public void onCreate(Bundle savedInstanceState) {  
  5.         super.onCreate(savedInstanceState);  
  6.         requestWindowFeature(Window.FEATURE_NO_TITLE);       
  7.         setContentView(R.layout.main);  
  8.           
  9.         Integer[] images = { R.drawable.image01,   
  10.                              R.drawable.image02,   
  11.                              R.drawable.image03,   
  12.                              R.drawable.image04,   
  13.                              R.drawable.image05};  
  14.           
  15.         ImageAdapter adapter = new ImageAdapter(this, images);  
  16.         adapter.createReflectedImages();//创建倒影效果   
  17.         GalleryFlow galleryFlow = (GalleryFlow) this.findViewById(R.id.gallery);  
  18.         galleryFlow.setFadingEdgeLength(0);  
  19.         galleryFlow.setSpacing(10); //图片之间的间距   
  20.         galleryFlow.setAdapter(adapter);  
  21.           
  22.         galleryFlow.setOnItemClickListener(new OnItemClickListener() {  
  23.             public void onItemClick(AdapterView<?> parent, View view,  
  24.                     int position, long id) {  
  25.                 Toast.makeText(getApplicationContext(), String.valueOf(position), Toast.LENGTH_SHORT).show();  
  26.             }  
  27.               
  28.         });  
  29.         galleryFlow.setSelection(4);  
  30.     }  
linux
相关资讯       Android源码 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* 匿名 发表于 2013/10/9 10:23:10
能不能把你的xml布局代码也发出来啊!