- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
android的网格布局(Android grid layout)
Android grid layout
(2011-08-01, 10:25:56)
Reprint
Label:
Android
GridView
Grid view
Adapter
It
Category: Android
Androids grid layout uses GridView to display content in rows and columns. Generally suitable for display icons, pictures, pictures, buttons and so on. When writing, write a class that inherits BaseAdapter.
Example code is as follows:
Package com.zhchyun.activity;
Import android.app.Activity;
Import android.content.Context;
Import android.content.Intent;
Import android.os.Bundle;
Import android.view.View;
Import android.view.ViewGroup;
Import android.widget.AdapterView;
Import android.widget.BaseAdapter;
Import android.widget.GridView;
Import android.widget.ImageView;
Import android.widget.AdapterView.OnItemClickListener;
Public, class, IndexActivity, extends, Activity {
Private GridView gv;
@Override
Public, void, onCreate (Bundle, savedInstanceState) {
Super.onCreate (savedInstanceState);
SetContentView (R.layout.main);
Gv= (GridView) findViewById (R.id.gridview01);
Set the number of columns.
Gv.setNumColumns (3);
/ / configure the adapter
Gv.setAdapter (New MyAdapter (this));
The configuration / / listener, write on the selected icon operation. Jump to SysManActivity in the example
Gv.setOnItemClickListener (new, OnItemClickListener () {
@Override
Public, void, onItemClick (AdapterView, , arg0, View, arg1, int, arg2,
Long, ARG3) {
Intent, intent, =new, Intent ();
Intent.setClass (IndexActivity.this, SysManActivity.class);
StartActivity (intent);
}
});
}
/ / internal class to override the BaseAdapter, set up your own adapter
Class MyAdapter extends BaseAdapter{
Private Integer[] img={
R.drawable.icon,
R.drawable.icon,
R.drawable.icon,
R.drawable.icon,
R.drawable.icon,
R.drawable.icon,
R.drawable.icon,
R.drawable.icon,
R.drawable.icon,
};
Context context;
/ / enough for
Public MyAdapter (Context, context) {
This.context=context;
}
@Override
/ / get the total number of
Public, int, getCount () {
Return img.length;
}
@Ove
您可能关注的文档
- u盘使用终极攻略(U use ultimate Raiders).doc
- u盘修复的几种方法(U disk repair methods).doc
- 公司知情权与劳动者隐私权如何平衡保护(How to balance the company's right to know and the right to privacy of workers).doc
- 公司治理结构(Corporate governance structure).doc
- u盘用处知多少(U know how much.).doc
- u盘终极使用(The ultimate use of U).doc
- ultrafunk简介(ultrafunk简介).doc
- 公务员 准备(Civil service preparation).doc
- v ray使用方法(V ray usage).doc
- vary材质参数(Vary material parameters).doc
- android系统文件夹结构说明,附带可以删除的文件列表(Android system folder structure notes, with a list of files that can be deleted).doc
- ansysy安装方法(ANSYSY installation method).doc
- ansys常见错误分析(ANSYS common error analysis).doc
- ansys单元划分技巧(ANSYS cell partitioning techniques).doc
- ansys拉伸成体命令流(ANSYS stretched body command stream).doc
- ansys面映射网格(ANSYS surface mapping mesh).doc
- ansys网格划分(ANSYS mesh generation).doc
- altium designer学习笔记(转)(Altium Designer学习笔记(转)).doc
- ansys中t梁变截面(经典)(T beam cross section (classical) in ANSYS).doc
- arcsde for oracle配置和调整初步(arcsde for oracle配置和调整初步).doc
文档评论(0)