lzl_imageloader's Introduction
2016-01-07 一、这节主要学习下bitmap的高效加载和cache存储的策略 1.1 bitmap的高效加载。 ----|bitmap的加载图片的四种方式,decodeFile、decodeResource、decodeStream decodeByteArray. ----|使用bitmapFactory.options方法进行图片的缩放。 图片缩放的策略是 采用inSampleSize(采样率)来设置缩放的比例大小。 以下是具体的实现 二、ImageLoader的实现 图片的高效缓存类。 * 主要通过LruCache内存缓存和DiskLruCache磁盘缓存来工作。 * 该类的实现**: 通过loadBitmap方法来分别从缓存、磁盘和网络中加载图片(这里是一层一层来判断的, * 如果缓存中有这个图片程序变不再向下执行)。 * 步骤: * 1、ImageLoader构造方法,初始化LruCache和DiskLruCache类。 * 2、分别实现LruCache和DiskLruCache的增加、删除、查找方法。 2016-01-12 《学习Android开发艺术探索》----View的滑动冲突 //今天来学习一下View的滑动冲突,主要从滑动冲突的产生原因和滑动冲突的解决方案出发。 View滑动冲突产生的三个冲突场景。 场景1、外部View左右滑动,内部View上下滑动 场景2、外部View上下滑动,内部View也上下滑动 场景3、场景1和场景2之间的混合滑动。 ---------------------------------- 场景1和场景2都是比较常见的页面布局。因此解决这种滑动冲突十分必要 据我现在的了解,场景1现在可以使用ViewPager+Fragment来避免这种滑动的冲突。 场景2这种布局,我现在在写的项目中使用了NestedScrollView+RecyclerView这种布局方式, 也没有遇到这种冲突的情况。 所以,我想说的是,如果可以避免这些冲突那就尽量的去绕开这些冲突;如果避免不了滑动冲突, 那么我们可以借鉴以下的解决滑动冲突的思路,来解决我们的问题。 ---------------------------------场景1--------------------------------------- 首先来构造一个场景1的滑动冲突,并给出解决思路(这些例子来自于Android开发艺术探索)。 1 场景1的滑动冲突处理规则 场景1是一个简单的滑动冲突,外部View是左右滑动,内部View上下滑动。 当用户上下滑动时,我们希望内部View来处理事件;当用户左右滑动时,我们希望外部View来处理事件。 因此,我们可以通过判断用户的手势滑动方向,来决定是哪个View来处理事件。 1.1外部拦截方法: ----|事件拦截与处理 1.2内部拦截方法: ----|内部拦截方法,重写内部ListView,并修改其dispatchTouchEvent方法中的父容器的拦截逻辑, 让父容器拦截ACTION_MOVE和ACTION_UP事件。
lzl_imageloader's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.