- 浏览: 827274 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
renzhengzhi:
请教一下楼主,公有云和私有云的开发,具体要做哪些工作呢?我拿到 ...
4,云的4 种模式 -
SangBillLee:
我用了solr5.5,用SolrQuery查询,没法高亮,不知 ...
solr5.x快速入门 -
lw900925:
这翻译读起来真是别扭。
solr in action翻译-第一章1.1 -
springjpa_springmvc:
spring mvc demo教程源代码下载,地址:http: ...
Spring MVC性能提升 -
h416373073:
正遇到了此问题不知如何解决, 多谢分享
solr错误
1,创建配置文件
<?xml version="1.0" encoding="utf-8"?> <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallery" android:layout_width="fill_parent" android:layout_height="wrap_content" > </Gallery>
2,编写适配器,因为Gallery 需要一个适配器填充,而且填充的必须输图片,所以。。。
package com.kang.fei.gallery; import android.content.Context; import android.content.res.TypedArray; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.ImageView; public class ImageAdapter extends BaseAdapter { private Context context; int mGalleryItemBackground; private Integer[] mImageids ={ R.drawable.sample_0,R.drawable.sample_1, R.drawable.sample_2,R.drawable.sample_3, R.drawable.sample_4,R.drawable.sample_5, R.drawable.sample_6 }; public ImageAdapter(Context context){ this.context = context; //TypedArray实例是个属性的容器,context.obtainStyledAttributes()方法返回得到 TypedArray a = context.obtainStyledAttributes(R.styleable.HelloGallery); mGalleryItemBackground = a.getResourceId (R.styleable.HelloGallery_android_galleryItemBackground, 0); a.recycle(); } public int getCount() { return mImageids.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(context); i.setImageResource(mImageids[position]); i.setLayoutParams(new Gallery.LayoutParams(150,100)); i.setScaleType(ImageView.ScaleType.FIT_XY); i.setBackgroundResource(mGalleryItemBackground); return i; } }
3,编写一个attrs.xml文件,防止在values文件颊下
<?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="HelloGallery"> <attr name="android:galleryItemBackground"/> </declare-styleable> </resources>
4,编写主层序类
package com.kang.fei.gallery; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Gallery; import android.widget.Toast; public class GalleryActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Gallery g = (Gallery) findViewById(R.id.gallery); g.setAdapter(new ImageAdapter(this)); g.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(GalleryActivity.this, " "+position,1).show(); } }); } }
发表评论
-
Android SDK更新 Connection to http://dl-ssl.google.com refused 解决方法 .
2013-10-10 11:38 1182问题描述使用SDK Manager ... -
android 对话框中的进度条 (ProgressDialog)
2012-03-10 00:16 2560显然要定义对话框进 ... -
Android开发学习笔记WebView
2012-02-28 21:59 5114WebView(网络视图)能加载 ... -
Android ListView理解之BaseAdapter .
2012-02-28 21:43 2042ListView是Android开发过程中较为常见的组件之一, ... -
AsyncTask的用法
2012-02-27 21:36 885在开发Android应用时必须遵守单线程模型的原则: An ... -
android中的ellipsize
2012-02-26 17:47 1062最近为了解决某个bug,textview中内容过长的话自动 ... -
BaseExpandableListAdapter
2012-02-26 17:40 1547转载自:中国手机开 ... -
使用命令安装apk的方法
2012-02-26 15:44 1687使用命令安装apk的方法, 第一步,将应用防止在androi ... -
Android PendingIntent和Intent的区别
2012-02-16 22:39 1722以前在学习AlarmManager里面会遇到PendingI ... -
android的tabHost的使用
2012-02-13 22:10 1564废话不多,直接介绍怎么使用 1,用几个tab,就建立几个ta ... -
android源码解析之二ApplicaitonInfo和PackageManager
2012-02-07 13:26 2245ApplicationInfo ApplicationIn ... -
android源码解读一(Context)
2012-02-05 21:13 4248Context类 Context是一个抽象类 public ... -
android 属性android:visibility
2012-02-05 12:16 934此属性意思是此视图是否显示, 例如RelativeLayou ... -
android默认焦点设置的方法
2012-02-05 12:13 18901在使用到文本框(EditText)来进行数据录入的时候,有时默 ... -
imageView.setScaleType
2012-02-03 17:36 5985imageView.setScaleType(ImageVie ... -
文件在SD卡存储
2012-02-02 10:47 1755手机的存储空间分俩种,一种是手机自带的,另一种是SD卡,(外存 ... -
广播接收者
2012-02-02 10:45 1213广播接受者(BroadcastReceiv ... -
android的服务
2012-02-02 10:45 973服务android中服务和window中的服务是类似的东西,服 ... -
android资源的应用
2012-02-02 10:43 1455color颜色在配置文件中定义路径:res/values/co ... -
android图片的旋转和缩放
2012-02-02 10:42 1702使用Android中的Matrix类实现 //加载需要操 ...
相关推荐
android开发中,Gallery控件的使用,详细可以参见博客:http://www.cnblogs.com/plokmju/p/android_Gallery.html
实现Android中gallery图片自动切换。
android----gallery、iamgeswitcher组件详解,及简单实例。
Android 重写Gallery实现gallery的动画切换效果
android 4.0 Gallery源码
Android照片墙Gallery程序源码
android gallery简单应用,里面有对gallery源码例子
android gallery例子android gallery例子android gallery例子
Gallery即为画廊,美术馆的意思,Android为我们开发者提供了这么一个view组件,极大的方便我们开发图片类应用,而且效果很美观,再配合上开发者独自添加进去的效果,Gallery相关的开发变得越来越吃香。
android整个Gallery模块的应用层源代码,供大家学习。
Android 使用Gallery_tabhost实现标签效果图源码.rar
android gallery demoandroid gallery demoandroid gallery demo
android Gallery + ImageSwitcher
android中的gallery的一个样式,具有倒影效果。左右滑动也不错。
Android Gallery 自定义ImageView和Gallery实现图片浏览功能,类似Android图库软件,主要实现的功能有:图片左右滑动、放大缩小、放大弹回、缩小弹回。 一开始使用Viewpager实现图片浏览,发现两张图片滑动时没有...
android 环形gallery 源码 超炫效果
Android应用源码之Gallery2_Android
针对Android应用中Gallery内存溢出的解决方案
Android Gallery控件使用实例
自己写的一个Android Gallery 小例子,共享给大家顺便自己保存一下。