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;
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
应用源码仿ireader书架.zip (66个子文件)
应用源码仿ireader书架
qianfeng_reader
project.properties 360B
.classpath 475B
src
go
qianfeng
ui
ReaderActivity.java 3KB
res
drawable-mdpi
ic_launcher.png 3KB
drawable-ldpi
ic_launcher.png 2KB
values
strings.xml 175B
layout
bookshelfitem.xml 580B
main.xml 368B
shelf_list_item.xml 2KB
shelf.xml 1KB
drawable-hdpi
head_left.png 118B
guide.png 9KB
cover_epub.png 11KB
head_right.png 118B
default_cover.png 31KB
bookshelf_header_bg.png 19KB
bookshelf_layer_center.png 70KB
bookshelf_layer_right.png 4KB
bookshelf_goto_bookcity.png 8KB
bookshelf_header_logo.png 4KB
bookshelf_goto_bookcity_f.png 8KB
bookshelf_goto_bookcity_0.xml 321B
bookshelf_layer_left.png 4KB
cover_pdb.png 11KB
cover_ebk.png 11KB
bookshelf_layer.png 384B
ic_launcher.png 4KB
bin
classes
go
qianfeng
ui
ReaderActivity$ShelfAdapter.class 2KB
ReaderActivity.class 1KB
R$string.class 415B
R$layout.class 487B
R$id.class 706B
BuildConfig.class 337B
R$attr.class 328B
R$drawable.class 1KB
ReaderActivity$ButtonOnClick.class 1KB
R.class 503B
resources.ap_ 208KB
qianfeng_reader.apk 214KB
jarlist.cache 120B
res
drawable-mdpi
ic_launcher.png 2KB
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
head_left.png 118B
guide.png 9KB
cover_epub.png 11KB
head_right.png 118B
default_cover.png 31KB
bookshelf_header_bg.png 19KB
bookshelf_layer_center.png 70KB
bookshelf_layer_right.png 4KB
bookshelf_goto_bookcity.png 8KB
bookshelf_header_logo.png 4KB
bookshelf_goto_bookcity_f.png 8KB
bookshelf_layer_left.png 4KB
cover_pdb.png 11KB
cover_ebk.png 11KB
bookshelf_layer.png 384B
ic_launcher.png 4KB
classes.dex 7KB
dexedLibs
annotations-5bbb0a59cf663c535a64f12025aaf441.jar 943B
AndroidManifest.xml 689B
proguard.cfg 1KB
.project 851B
AndroidManifest.xml 689B
gen
go
qianfeng
ui
BuildConfig.java 156B
R.java 2KB
共 66 条
- 1
资源评论
Soft_Leader
- 粉丝: 1363
- 资源: 1656
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功