仿ireader书架

时间:2017-07-17 09:22:54
【文件属性】:

文件名称:仿ireader书架

文件大小:829KB

文件格式:ZIP

更新时间:2017-07-17 09:22:54

ireader

仿ireader书架,android 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; } } } }


【文件预览】:
qianfeng_reader
----.project(851B)
----bin()
--------res()
--------qianfeng_reader.apk(213KB)
--------resources.ap_(208KB)
--------classes()
--------classes.dex(5KB)
----proguard.cfg(1KB)
----AndroidManifest.xml(689B)
----src()
--------go()
----project.properties(360B)
----res()
--------values()
--------layout()
--------drawable-ldpi()
--------drawable-hdpi()
--------drawable-mdpi()
----.classpath(364B)
----gen()
--------go()
----assets()
说明.html

网友评论