- 浏览: 126575 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
sing0231:
...
android image加载中等待动画 -
云上太阳:
写的挺好的嘛, 回调机制都用了。。。
android 通过Service和Receiver来监听网络状态 -
ponos:
...
android 通过Service和Receiver来监听网络状态 -
Will.Du:
你这哪是直接打开,分明就是拷贝了一遍么
android 直接读取assets下数据库
重写Gallery,解决惯性问题……
package com.app.test9; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.Gallery; public class GalleryTest extends Gallery { public GalleryTest(Context context, AttributeSet attrs) { super(context, attrs); } //冲洗这个方法返回flase,就可以去掉gallery的惯性,每次只滑动一张 public boolean onFling (MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return false; } }
Gallery自动播放
public class AoutGalleryActivity extends Activity { private GalleryTest mGalleryItem; private static int[] mThumbIds = { R.drawable.g1, R.drawable.test, R.drawable.java,R.drawable.filepicker_return,R.drawable.more_feedback}; Timer timer; Handler handler; int current = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setupViews(); init(); handler = new Handler() { public void handleMessage(Message msg) { if(msg.what == 0x123) { //设置gallery显示第几张图片 mGalleryItem.setSelection(current); } } }; } private void init() { timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { current++; if(current>=5) //5是存图片的数组,数组的长度 { current = 0;//此处如果需要gallery循环播放,就需要这么写 } Message msg = new Message(); msg.what = 0x123; handler.sendMessage(msg); } }, 0, 1000); }
private void setupViews() { mGalleryItem = (GalleryTest) findViewById(R.id.gallery); show = (TextView)findViewById(R.id.text); final ImageAdapter adapter = new ImageAdapter(this,mThumbIds); mGalleryItem.setAdapter(adapter); mGalleryItem.setSelection(2); mGalleryItem.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { //show.setText(names[position]); } public void onNothingSelected(AdapterView<?> parent) { } }); }
适配器
如果需要gallery 循环播放,就要 position % mThumbIds.length 写
private final static class ImageAdapter extends BaseAdapter { private Context mContext; int[] mThumbIds; public ImageAdapter(Context c,int[] mThumbIds) { mContext = c; this.mThumbIds = mThumbIds; } public int getCount() { return Integer.MAX_VALUE; } public Object getItem(int position) { return mThumbIds[position % mThumbIds.length]; } public long getItemId(int position) { return position % mThumbIds.length; } public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { imageView = new ImageView(mContext); imageView.setAdjustViewBounds(true); imageView.setLayoutParams(new Gallery.LayoutParams(360,240)); imageView.setScaleType(ImageView.ScaleType.FIT_XY); } else { imageView = (ImageView) convertView; } imageView.setImageResource(mThumbIds[position % mThumbIds.length]); return imageView; } }
发表评论
-
android 通过Service和Receiver来监听网络状态
2013-11-27 11:07 16215注:本内容部分来自网络 需要在Activity中得 ... -
广播中处理短信内容
2013-01-11 12:24 866package cn.com.jbit.receiver; ... -
pull 生成xml
2013-01-07 16:18 1100package com.jbit.keepintouch; ... -
SAX 生成XML文件
2013-01-07 15:56 6217package com.jbit.sax; impor ... -
代码写入xml
2013-01-07 15:44 0package com.jbit.sax; import ... -
android string.xml显示特殊符号
2012-12-11 15:30 2414项目中要在string.xml 中显示特殊符号,如@号冒号等, ... -
android post请求
2012-11-01 09:02 1635/* * post请求, parMap参数集合 ... -
android image加载中等待动画
2012-10-31 13:59 8170在布局中添加一个ImageViw和一个EditText。 ... -
android dialog加载中动画效果
2012-10-29 10:40 14866//显示动画 dialog = new Dialog(con ... -
获取android手机基本信息
2012-09-12 16:49 20389/** * 获取android当前可用内存大小 ... -
解决TextView跑马灯效果,无法获取焦点问题
2012-08-13 15:38 4670重写TextView 让TextView 一直获取焦点 ... -
android MediaPalyer播放音乐 获得asset资源文件
2012-08-13 15:19 18425import android.app.Activity; i ... -
ContentProvider 获取联系人
2012-07-06 16:04 928public class GetContact extends ... -
TabHost 调用模版使用方法
2012-07-06 16:01 860import android.app.TabActivity; ... -
判断网络是否可用
2012-07-06 15:32 1036import java.util.List; impor ... -
android 记录所有打开的Activity,退出程序
2012-07-03 22:37 4222package com.main.server; imp ... -
从网络获取图片
2012-06-12 18:44 1065public class HttpGetI ... -
从网络获取图片
2012-06-12 18:21 0public class HttpGetImageActivi ... -
android 实现打电话
2012-05-17 21:57 0public class TelephoneActivity ... -
andorid ExpandableListView 用法
2012-04-24 13:19 1121public class ExpandableListView ...
相关推荐
可以实现gallery浏览图片,手指滑动可以浏览,并且增加了字典里滑动图片方便大家浏览,图片还有文字说明,下面图片滚动标志。
android中运用gallery进行图片浏览,并用定时器实现图片的自动滑动浏览。
启动图滑动+gallery滑动 自动
android 使用GridView实现Gallery的效果,并且从最左边开始
gallery 图片触摸滑动播放 ,触摸后,自动播放停止,转为滑动播放,简单例子
Gallery控件,手动滑动的效果,里面是一个完整的代码
Android 滑动效果 Gallery
利用ViewPager实现3D页面滑动效果,关联gallery滑动,实现对应滑动,每一个页面都是单独的fragment实现,方便流畅
这是一个倾斜的gallery 适用于各种应用或游戏的菜单界面 自动播放功能为测试功能 觉得好可以完善 觉得不好就删除相应的button监听
在网上了很久,貌似都没有找到Gallery自动滑动的Demo,我也是参看了别人的程序,才总结出了一个Demo,这才分享出来,希望能给你带来帮助。有什么疑问,可以给我留言。
Gallery的滑动效果,ImageView的圆角绘制,以及ImageView的选中效果
通过SurfaceView实现像Gallery手势滑动图片效果
Android 两个gallery同时滑动
Android 滑动效果 Gallery + GridView
Android Gallery 左对齐,点击禁止滑动 demo
图片自动滑动 同时也可以自动滑动 时间有自己控制
C# Android Gallery-Dome图片滑动效果显示
Gallery组件主要用于横向显示图像列表,不过按常规做法。工程源代码,解压导入即可学习,有注释。
一款实现左右滑动浏览图片中间放大的效果 自定义gallery
无限循环滑动 gallery viewPager 自定义组件 我都封装起来了很简单,好用!