ScrollView 透明 Actionbar
2015-12-10 15:31
351 查看
NotifyingScrollView
调用
package com.app.lx.actionbar; import android.content.Context; import android.util.AttributeSet; import android.widget.ScrollView; public class NotifyingScrollView extends ScrollView{ /** * @author Cyril Mottier */ public interface OnScrollChangedListener { void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt); } private OnScrollChangedListener mOnScrollChangedListener; public NotifyingScrollView(Context context) { super(context); } public NotifyingScrollView(Context context, AttributeSet attrs) { super(context, attrs); } public NotifyingScrollView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); if (mOnScrollChangedListener != null) { mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt); } } public void setOnScrollChangedListener(OnScrollChangedListener listener) { mOnScrollChangedListener = listener; } }
调用
nsv_store.setOnScrollChangedListener(new OnScrollChangedListener() { @SuppressLint("NewApi") @Override public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) { // 当店铺整个界面滚动的时候,改变相对应的操作 if (ab_top == null) { return; } if(t<0){ return; } int lHeight = ab_top.getHeight(); if (t <= lHeight) { int progress = (int) (new Float(t) / new Float(lHeight) * 255); ab_top.getBackground().setAlpha(progress); } else { ab_top.getBackground().setAlpha(255); } } });
相关文章推荐
- NODE 安装express4.X 失败
- Linux新手要了解的十个知识点
- Android内存分析工具DDMS heap + MAT 安装和使用
- Web API 数据流使用
- 《HTTP权威指南》– 8.网关、Web机器人
- jQuery 的 ready 函数是如何工作的?(源码分析)
- Xcode 工具栏详解
- android 证书签名命令
- servlet笔记
- 移动web开发viewport记录
- Angular2入门(二)
- JAVA配置文件之web.xml
- Qt浅谈之三十六仿360设置中心
- 计算机视觉领域的一些牛人博客,超有实力的研究机构等的网站链接
- tftp服务配置
- wpf C# 数据库 c/s 个人信息管理 wpf局域网通信
- Springmvc+uploadify实现文件上传
- python基础教程共60课-第24课if的嵌套
- Vickate_App上线流程 iOS_bay亲测可用 快来mark
- BAT安卓工程师面试流程解析+还原最真实最完整的一线公司面试题