为什么查录取结果手机老是跳出广告信息框让你输个人信息,却不能转到

Android开发:Parallax效果的ScrollerView,改编自ParallaxListView
最近在项目中,有用到一个仿照Path的Parallax效果,苦苦搜寻,在github上面,有一个类似的效果,不过是listview的,加一个顶部的headerView,实现了该效果,不过我需要的是ScrollerView的,于是对该代码进行的修改,实现了ScrollerView下面的Parallax效果,效果图参照如下:
在阅读下面代码前,可以先查看下Github上面的
我对于原先的代码进行了大量的删减,只实现了我需要的效果,看起来简单易懂,最怕那种绕来绕去的代码了,看核心的实现代码:
public class ParallaxScollView extends ScrollView implements OnScrollListener {
public final static double NO_ZOOM = 1;
public final static double ZOOM_X2 = 2;
private ImageView mImageV
private int mImageViewHeight = -1;
private int mDefaultImageViewHeight = 0;
private int originImageViewH
private int mMaxH
private interface OnOverScrollByListener {
public boolean overScrollBy(int deltaX, int deltaY, int scrollX,
int scrollY, int scrollRangeX, int scrollRangeY,
int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent);
private interface OnTouchEventListener {
public void onTouchEvent(MotionEvent ev);
public ParallaxScollView(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
init(context);
public ParallaxScollView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
public ParallaxScollView(Context context) {
super(context);
init(context);
public void init(Context context) {
mDefaultImageViewHeight = context.getResources().getDimensionPixelSize(R.dimen.size_default_height);
originImageViewHeight = context.getResources().getDimensionPixelSize(R.dimen.size_default_height);
public void onScrollStateChanged(AbsListView view, int scrollState) {
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX,
int scrollY, int scrollRangeX, int scrollRangeY,
int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
boolean isCollapseAnimation =
isCollapseAnimation = scrollByListener.overScrollBy(deltaX, deltaY,
scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX,
maxOverScrollY, isTouchEvent)
|| isCollapseA
/*return isCollapseAnimation ? true : super.overScrollBy(deltaX, deltaY,
scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX,
0, isTouchEvent);*/
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
View firstView = (View) mImageView.getParent();
// firstView.getTop & getPaddingTop means mImageView will be covered by top padding,
// so we can layout it to make it shorter
if (firstView.getTop() & getPaddingTop() && mImageView.getHeight() & mImageViewHeight) {
mImageView.getLayoutParams().height = Math.max(mImageView.getHeight() - (getPaddingTop() - firstView.getTop()), mImageViewHeight);
// to set the firstView.mTop to 0,
// maybe use View.setTop() is more easy, but it just support from
3.0 (API 11)
firstView.layout(firstView.getLeft(), 0, firstView.getRight(), firstView.getHeight());
mImageView.requestLayout();
public boolean onTouchEvent(MotionEvent ev) {
touchListener.onTouchEvent(ev);
return super.onTouchEvent(ev);
public void setParallaxImageView(ImageView iv) {
mImageView =
mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
public void setViewsBounds(double zoomRatio) {
if (mImageViewHeight == -1) {
mImageViewHeight = mImageView.getHeight();
if (mImageViewHeight &= 0) {
mImageViewHeight = mDefaultImageViewH
double ratio = ((double) mImageView.getDrawable().getIntrinsicWidth()) / ((double) mImageView.getWidth());
private OnOverScrollByListener scrollByListener = new OnOverScrollByListener() {
public boolean overScrollBy(int deltaX, int deltaY, int scrollX,
int scrollY, int scrollRangeX, int scrollRangeY,
int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
if (isTouchEvent) {
if (true) {
mImageView.getLayoutParams().height = mImageView.getHeight() - deltaY / 2;
mImageView.requestLayout();
private OnTouchEventListener touchListener = new OnTouchEventListener() {
public void onTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_UP) {
if (mImageViewHeight - 1 & mImageView.getHeight()) {
ResetAnimimation animation = new ResetAnimimation(
mImageView, mImageViewHeight);
animation.setDuration(300);
mImageView.startAnimation(animation);
public class ResetAnimimation extends Animation {
int targetH
int originalH
int extraH
protected ResetAnimimation(View view, int targetHeight) {
this.mView =
this.targetHeight = targetH
originalHeight = view.getHeight();
extraHeight = this.originalHeight - originImageViewH
Log.i(debug, target heitht
+ targetHeight +
original height
+ originalHeight
extraheight
+ extraHeight);
protected void applyTransformation(float interpolatedTime, Transformation t) {
newHeight = (int) (originImageViewHeight + extraHeight * (1 - interpolatedTime));
mView.getLayoutParams().height = newH
mView.requestLayout();
第二布:在xml中,引用该ParallaxScollView:
最后一步,在activity中,引用ParallaxScrollerView,并且设置imageview:
mImageView = (ImageView) findViewById(R.id.headview);
scrollView = (ParallaxScollView) findViewById(R.id.parallax_scroll_view);
scrollView.setParallaxImageView(mImageView);
大功告成,也可以在ScrollerView上实现炫酷的Parallax效果了
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'百度爸妈搜索
立即登录点击,留下生活便签
实时搜索风云榜
其他人都在看
其他人都在看
其他人都在看
其他人都在玩
今天多云36~28℃[明日预报] 35~28℃ 多云 30星期六宜求医治病破屋忌嫁娶出行宜求医、治病、破屋、坏垣、余事勿取、忌嫁娶、出行、 生活工具
您在爸妈百度遇到任何问题、有任何需要,都请告诉我们。后使用快捷导航没有帐号?
请完成以下验证码
&&&全站 说: 2小时前全站 说: 4天前全站 说: 石化区“我在节能你在哪里”7月底活动结束,8月份公布获奖选手。未参与人员尽快参加。
6天前全站 说: 10天前全站 说: 12天前全站 说: 19天前全站 说: 19天前全站 说: 23天前全站 说: 23天前
查看: 157|回复: 5
(977022号)
收到鲜花 朵
阅读权限220
主题好友积分
签到天数: 467 天连续签到: 5 天[LV.6]海川常住居民III&
申领前提条件为5威望,对海川热心参与的会员
TA在日20时20分获得了这枚徽章。 []
发帖数超过2099个即可自领本徽章
TA在日11时42分获得了这枚徽章。 []
已提交版主身份信息登记
TA在日09时28分获得了这枚徽章。 []
本帖最后由 幸好有你 于
10:59 编辑
为啥我的版主马甲,不能发新帖和采用“高级模式”?跳出如下对话框内容:
抱歉,您尚未输入标题或内容
[url=][ 点击这里返回上一页 ][/url]
@zhangqi1234 @清洁工
正常回复却可以。
现在好了吗,如果直接登录呢&
(874039号)
收到鲜花 朵
阅读权限150
零点可可的管辖
签到天数: 160 天连续签到: 3 天[LV.4]海川常住居民I&
此帖仅作者可见
收到鲜花 朵
阅读权限255
主题好友积分
&成长值: 3787VIP5, 成长值 7200, 距离下一级还需 3413 成长值签到天数: 975 天连续签到: 1 天[LV.7]以坛为家I&
2015年海川十佳会员专用,获得海川化工论坛2015年十佳会员称号
TA在日21时59分获得了这枚徽章。 []
贡献点20可领取本徽章,贡献点是历次活动及管理中表现突出能得到的
TA在日11时28分获得了这枚徽章。 []
最佳应助(答案)500次的会员,可自领本徽章。代表成为海川自由应助团队的正式一员的象征。
TA在日16时12分获得了这枚徽章。 []
最佳应助(答案)300次的会员,可自领本徽章。代表成为海川自由应助团队的正式一员的象征。
TA在日16时12分获得了这枚徽章。 []
最佳应助(答案)100次的会员,可自领本徽章。代表成为海川自由应助团队的正式一员的象征。
TA在日16时11分获得了这枚徽章。 []
已提交版主身份信息登记
TA在日12时51分获得了这枚徽章。 []
海川社区常住居民 在海川签到500天 可领本徽章
TA在日12时49分获得了这枚徽章。 []
热心参与帮助他人,---- 应助(最佳答案-5次)数在50次以上的可自动领取本徽章
TA在日12时49分获得了这枚徽章。 []
在线时间达到2400小时,可以直接领取本徽章。
TA在日12时49分获得了这枚徽章。 []
发帖数超过2099个即可自领本徽章
TA在日12时49分获得了这枚徽章。 []
申领前提条件为5威望,对海川热心参与的会员
TA在日12时49分获得了这枚徽章。 []
此帖仅作者可见
(977022号)
收到鲜花 朵
阅读权限220
主题好友积分
签到天数: 467 天连续签到: 5 天[LV.6]海川常住居民III&
申领前提条件为5威望,对海川热心参与的会员
TA在日20时20分获得了这枚徽章。 []
发帖数超过2099个即可自领本徽章
TA在日11时42分获得了这枚徽章。 []
已提交版主身份信息登记
TA在日09时28分获得了这枚徽章。 []
此帖仅作者可见
海川化工论坛网化工技术交流第一站,共同学习 共同提高!
广告投放与宣传
违规贴举报删除请联系邮箱:
丰行天下-海川化工论坛 版权所有--- Powered by}

我要回帖

更多关于 输入法老是自动跳出来 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信