package go.qianfeng.ui;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
public class ReaderActivity extends Activity {
private ShelfAdapter mAdapter;
private Button shelf_image_button;
private ListView shelf_list;
private Button button_1 , button_2 , button_3;
@ Override
public void onCreate ( Bundle savedInstanceState ) {
super.onCreate ( savedInstanceState );
setContentView ( R.layout.shelf );
init ();
mAdapter = new ShelfAdapter ();//new adapter对象才能用
shelf_list.setAdapter ( mAdapter );
}
private void init () {
shelf_image_button = ( Button ) findViewById ( R.id.shelf_image_button );
shelf_list = ( ListView ) findViewById ( R.id.shelf_list );
}
public class ShelfAdapter extends BaseAdapter {
int[ ] size = new int[ 10 ];//假设数据
public ShelfAdapter () {
}
@ Override
public int getCount () {
if ( size.length > 3 ) {
return size.length;
} else {
return 3;
}
}
@ Override
public Object getItem ( int position ) {
return size[ position ];
}
@ Override
public long getItemId ( int position ) {
return position;
}
@ Override
public View getView ( int position , View convertView , ViewGroup parent ) {
LayoutInflater layout_inflater = ( LayoutInflater ) ReaderActivity.this.getSystemService ( Context.LAYOUT_INFLATER_SERVICE );
View layout = layout_inflater.inflate ( R.layout.shelf_list_item , null );
Button button_1 , button_2 , button_3;
button_1 = ( Button ) layout.findViewById ( R.id.button_1 );
button_2 = ( Button ) layout.findViewById ( R.id.button_2 );
button_3 = ( Button ) layout.findViewById ( R.id.button_3 );
button_1.setOnClickListener ( new ButtonOnClick () );
button_2.setOnClickListener ( new ButtonOnClick () );
button_3.setOnClickListener ( new ButtonOnClick () );
return layout;
}
};
public class ButtonOnClick implements OnClickListener {
@ Override
public void onClick ( View v ) {
switch ( v.getId () ) {
case R.id.button_1 :
Toast.makeText ( ReaderActivity.this , "button1" , Toast.LENGTH_SHORT ).show ();
break;
case R.id.button_2 :
Toast.makeText ( ReaderActivity.this , "button2" , Toast.LENGTH_SHORT ).show ();
break;
case R.id.button_3 :
Toast.makeText ( ReaderActivity.this , "button3" , Toast.LENGTH_SHORT ).show ();
break;
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
android应用源码仿ireader书架-IT计算机-毕业设计.zip (66个子文件)
android应用源码仿ireader书架
qianfeng_reader
bin
classes.dex 7KB
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
bookshelf_goto_bookcity_f.png 8KB
bookshelf_layer_center.png 70KB
ic_launcher.png 4KB
bookshelf_goto_bookcity.png 8KB
bookshelf_header_logo.png 4KB
head_right.png 118B
bookshelf_layer_left.png 4KB
bookshelf_layer.png 384B
bookshelf_header_bg.png 19KB
cover_epub.png 11KB
bookshelf_layer_right.png 4KB
head_left.png 118B
guide.png 9KB
cover_pdb.png 11KB
cover_ebk.png 11KB
default_cover.png 31KB
drawable-mdpi
ic_launcher.png 2KB
qianfeng_reader.apk 214KB
jarlist.cache 120B
dexedLibs
annotations-5bbb0a59cf663c535a64f12025aaf441.jar 943B
classes
go
qianfeng
ui
ReaderActivity$ButtonOnClick.class 1KB
BuildConfig.class 337B
R$layout.class 487B
R$id.class 706B
R$drawable.class 1KB
ReaderActivity.class 1KB
R$attr.class 328B
R.class 503B
ReaderActivity$ShelfAdapter.class 2KB
R$string.class 415B
resources.ap_ 208KB
AndroidManifest.xml 689B
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
bookshelf_goto_bookcity_f.png 8KB
bookshelf_goto_bookcity_0.xml 321B
bookshelf_layer_center.png 70KB
ic_launcher.png 4KB
bookshelf_goto_bookcity.png 8KB
bookshelf_header_logo.png 4KB
head_right.png 118B
bookshelf_layer_left.png 4KB
bookshelf_layer.png 384B
bookshelf_header_bg.png 19KB
cover_epub.png 11KB
bookshelf_layer_right.png 4KB
head_left.png 118B
guide.png 9KB
cover_pdb.png 11KB
cover_ebk.png 11KB
default_cover.png 31KB
values
strings.xml 175B
drawable-mdpi
ic_launcher.png 3KB
layout
shelf_list_item.xml 2KB
shelf.xml 1KB
main.xml 368B
bookshelfitem.xml 580B
gen
go
qianfeng
ui
BuildConfig.java 156B
R.java 2KB
proguard.cfg 1KB
src
go
qianfeng
ui
ReaderActivity.java 3KB
.project 851B
.classpath 475B
project.properties 360B
AndroidManifest.xml 689B
共 66 条
- 1
芝麻粒儿
- 粉丝: 6w+
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0