- 浏览: 936641 次
- 性别:
- 来自: 山西
文章分类
最新评论
-
白小默:
你好 可以提供下源码DEMO吗,不知为何,我导出来的excel ...
jxls 使用模板文件导出生成excel -
zkzqzzz:
博主威武!
让微信二维码扫描您的APK -
zkzqzzz:
感谢博主 原来那些类都不是必须的 或者自己写!!博主真棒 ...
抢红包插件实现原理浅析 -
zkzqzzz:
博主 请问你的其他类在哪里呢?
抢红包插件实现原理浅析 -
zkzqzzz:
其他类在哪呢?
抢红包插件实现原理浅析
阅读过电子书的朋友相信对iReader都是比较熟悉的,iReader的书架做的非常漂亮,以前总以为是使用了2D画图做的呢,今天反编译了一下才明白原来是用图片拼接起来的,这样就OK了,今天我就带大家实现一个iReader书架。
首先看一下layout下main.xml布局:
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/bookshelf_header_bg" >
- <ImageView
- android:id="@+id/shelf_image_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:background="@drawable/bookshelf_header_logo" />
- <Button
- android:id="@+id/shelf_image_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:background="@drawable/bookshelf_goto_bookcity_f" />
- </RelativeLayout>
- <ListView
- android:id="@+id/shelf_list"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:scrollbars="none"
- android:divider="#00000000"
- android:cacheColorHint="#00000000"/>
- </LinearLayout>
由于书架是用图片拼成的,所以每一个行的数据框都是一个listview , 看一些listview对应的item布局:
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
- <ImageView
- android:id="@+id/shelf_image_left"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_centerVertical="true"
- android:background="@drawable/bookshelf_layer_left" />
- <LinearLayout
- android:id="@+id/linearLayout1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerVertical="true"
- android:layout_toLeftOf="@+id/shelf_image_right"
- android:layout_toRightOf="@+id/shelf_image_left"
- android:background="@drawable/bookshelf_layer_center"
- android:orientation="horizontal" >
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:gravity="center_horizontal" >
- <Button
- android:id="@+id/button_1"
- android:layout_width="80dip"
- android:layout_height="110dip"
- android:layout_marginTop="15dip"
- android:background="@drawable/default_cover" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:gravity="center_horizontal" >
- <Button
- android:id="@+id/button_2"
- android:layout_width="80dip"
- android:layout_height="110dip"
- android:layout_marginTop="15dip"
- android:background="@drawable/default_cover" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:gravity="center_horizontal" >
- <Button
- android:id="@+id/button_3"
- android:layout_width="80dip"
- android:layout_height="110dip"
- android:layout_marginTop="15dip"
- android:background="@drawable/default_cover" />
- </LinearLayout>
- </LinearLayout>
- <ImageView
- android:id="@+id/shelf_image_right"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:background="@drawable/bookshelf_layer_right" />
- </RelativeLayout>
最后是把item绑定到listview中:
- package cn.com.karl.reader;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.view.Window;
- import android.widget.BaseAdapter;
- import android.widget.ListView;
- public class IReaderActivity extends Activity {
- /** Called when the activity is first created. */
- private ListView shelf_list;
- // 书架的列数
- int[] size = new int[5];
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.requestWindowFeature(Window.FEATURE_NO_TITLE);
- setContentView(R.layout.main);
- shelf_list = (ListView) findViewById(R.id.shelf_list);
- ShelfAdapter adapter = new ShelfAdapter();
- shelf_list.setAdapter(adapter);
- }
- public class ShelfAdapter extends BaseAdapter {
- @Override
- public int getCount() {
- // TODO Auto-generated method stub
- return size.length;
- }
- @Override
- public Object getItem(int position) {
- // TODO Auto-generated method stub
- return size[position];
- }
- @Override
- public long getItemId(int position) {
- // TODO Auto-generated method stub
- return position;
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- // TODO Auto-generated method stub
- View layout = LayoutInflater.from(getApplicationContext()).inflate(
- R.layout.list_item, null);
- return layout;
- }
- }
- }
每一本书对应的点击事件这里并没有做,相信大家可以实现,OK,下面看一下运行后效果:
发表评论
-
Android客户端代码保护技术-完整性校验
2018-01-08 17:10 1256由于Android系统固有的缺陷、Android应用分发 ... -
android开发中手动v2签名实现方法
2018-01-08 10:31 1017用v2签名前要进行v1签名或zipalign。 1. z ... -
webview支持LocalStorage本地存储
2017-03-31 10:30 1364//允许JavaScript执行 ... -
七步配置phonegap+cordova+ionic开发环境
2016-12-19 16:21 695本文讲的是Android混合 ... -
梆梆加固破解
2016-10-13 09:01 1505本文假设你已经使用过梆梆加固,手头至少有个一个通过梆梆加固后 ... -
android zxing 扫描二维码 横屏转竖屏
2016-09-14 15:41 0Zxing 竖屏切换 Android 在google上下 ... -
封装Volley使Volley的每个请求都自动保存和发送Cookie
2016-09-14 10:57 0思路很简单,每次请求获取到服务器返回的response就解 ... -
Android二维码ZXing扫描区域大小的调整,提高扫描速度
2016-09-14 10:48 2641Zxing本身默认的扫图区域最大只有 360*480 ... -
解决Android二维码扫描ZXing竖屏拉伸变长闪退扫描区域小等问题
2016-09-14 10:42 1227Android 基于google Zxing实现二维码、条形 ... -
Android平台下利用zxing实现二维码开发
2016-09-14 09:25 482现在走在大街小巷都能看到二维码,而且最近由于项目需要,所以研 ... -
Zxing扫描二维码
2016-09-14 09:24 660摘要 android Zxing扫描二维码 横竖屏 ... -
Android 基于google Zxing实现二维码、条形码扫描,仿微信二维码扫描效果
2016-09-14 09:18 505转载请注明出处:http://blog.csdn.net/x ... -
React Native应用部署/热更新-CodePush最新集成总结
2016-08-02 11:06 566本文出自《React Native学习笔记》系列文章。 ... -
让微信二维码扫描您的APK
2016-07-27 11:26 1504二维码深入人心,很多App都在官网挂出了可以扫描下载apk的 ... -
Activity类的runOnUiThread方法
2016-07-22 10:40 768[javascript] view plain c ... -
Can't create handler inside thread that has not called Looper.prepare()
2016-07-22 10:24 630错误信息:在Android开发中,如果在一个Thread中启 ... -
Android编程之解决android-support-v4打包问题
2016-07-21 09:27 549如果工程引入了android-support-v4的jar类 ... -
Android 编程下的代码混淆之(android-support-v4.jar)
2016-07-21 09:24 394项目在代码混淆过程中如果引用了第三方 Jar 包,需要在混淆 ... -
phoneGap可行性分析
2016-07-20 16:25 5141 移动应用现状 移动应用产品往往常 ... -
梆梆SDKs详细分析(1) - 防界面劫持SDK
2016-07-20 10:23 754前言 前段时间,国外知名的安全公司fireeye发 ...
相关推荐
UI之高仿ireader书架效果,已经测试,请放心使用,在android2.3下即可运行
android应用源码仿ireader书架.zip
仿ireader书架,android public class ReaderActivity extends Activity { private ShelfAdapter mAdapter; private Button shelf_image_button; private ListView shelf_list; private Button button_1 , ...
仿掌阅iReader书架,自定义GridView实现。
仿掌阅iReader书架,自定义GridView实现。
android应用源码仿ireader书架.rar
Android程序研发源码仿ireader书架.zip
一个完整的仿ireader书架应用,只是一个Android仿ireader的界面效果,不包括业务内的代码,只是一个UI方面的设计参考,其运行效果如下图所示,对设计开发图书馆应用、书店租赁APP、书库APP应用等,界面方面都可以...
Android应用源码之仿ireader书架.zip
安卓Android源码——仿ireader书架.zip
安卓开发-仿ireader书架.zip.zip
Android应用源码之仿ireader书架.zip项目安卓应用源码下载Android应用源码之仿ireader书架.zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
安卓Android源码——仿ireader书架 (2).zip
类似Ireader书架布局的UI,该效果的布局有点像我们熟悉的ireader应用的布局书架,该项目实现了仿Ireader书架UI,具体如效果图所示,喜欢的可以收藏起来吧。
Android应用源码开发Demo,主要用于毕业设计学习。