仿Boss直聘我的介面滑動效果

2021-10-07 15:44:06 字數 3382 閱讀 3962

好久沒有寫部落格了,最近在找工作,我在使用boss投簡歷的時候,看到boss的我的介面蠻有意思的,就想如何去實現它,可能是職業病吧,所以就打算仿一下。先看下仿的效果。

其實我們拿到這個效果的時候,看到滑動,摺疊等效果就應該想到了material design,那麼我們現在就可以基本的布局下。

activity_main.xml布局

<?xml version="1.0" encoding="utf-8"?>

layout_top_view.xml

<?xml version="1.0" encoding="utf-8"?>

layout_content.xml   這裡就是乙個 擷取boss的

<?xml version="1.0" encoding="utf-8"?>

package com.zwl.mybossdemo;

import android.animation.valueanimator;

import android.content.context;

import android.util.attributeset;

import android.view.view;

import androidx.coordinatorlayout.widget.coordinatorlayout;

private view mcardview;

private boolean isanimate;

private float mtotaldy;

private float mlastscale;

private int mlastbottom;

private int mcardviewheight;

private int mlimitheight;

private valueanimator recoveryvalueanimator;

private view m*******;

private float scalevalue = 2f / 3;// 顯卡片的三分之一 所以丟擲三分之二

private view mnametitle;

}super(context, attrs);

}@override

boolean handled = super.onlayoutchild(parent, abl, layoutdirection);

if (null == mcardview)

if (null == m*******)

if (null == mnametitle)

init(abl);

return handled;

}@override

if (velocityy > 100)

return super.onnestedprefling(coordinatorlayout, child, target, velocityx, velocityy);

}@override

super.onstopnestedscroll(coordinatorlayout, abl, target, type);

//恢復位置

if (abl.getbottom() > mlimitheight)

}@override

//開始滾動了 就動畫歸位

isanimate = true;

return super.onstartnestedscroll(parent, child, directtargetchild, target, nestedscrollaxes, type);

}@override

if (mcardview != null && ((dy <= 0 && child.getbottom() >= mlimitheight) || (dy > 0 && child.getbottom() > mlimitheight))) else

}/**

* 初始化資料**/

//卡片的高度

mcardviewheight = mcardview.getmeasuredheight();

//摺疊正常的高度

//預設1s摺疊

@override

public void run()

});anim.start();

}}, 1000);

}/**

* 混動

** @param child

* @param target

* @param dy

*/mtotaldy += -dy;

mtotaldy = math.min(mtotaldy, mlimitheight);

mlastscale = math.max(1f, 1f + (mtotaldy / mlimitheight));

mlastbottom = mlimitheight + (int) (mcardviewheight * scalevalue * (mlastscale - 1));

child.setbottom(mlastbottom);

target.setscrolly(0);

}/**

* 根據滑動設定 ******* 名字顯示效果

** @param target

* @param dy

*/private void setviewalpha(view target, int dy)

//設定*******的透明度

m*******.setalpha(percent);

//設定名字縮放

mnametitle.setscalex(math.max(0.8f, 1 - percent));

mnametitle.setscaley(math.max(0.8f, 1 - percent));

//設定名字平移

int offset = mnametitle.gettop() - m*******.gettop();

mnametitle.settranslationy(-offset * percent);

}/**

* 恢復位置

** @param abl

*/if (mtotaldy >= 0)

});recoveryvalueanimator.start();

} else }}

}

github專案

仿Boss直聘 檢視頭像

gif.gif 怎麼用?override public void onclick view v else if r.id.iv v.getid 原理很簡單,package org.alex.bosszoomanim import org.alex.util.logutil public bosszo...

抓取boss直聘的資訊

from bs4 import beautifulsoup import requests import ip proxy from urllib import parse def get boss info my ip,detailed url url proxy response request...

仿VS安裝介面小球滑動效果

在visual studio 2010後續版本的安裝介面中,可以發現一組小球在滑動表示安裝程式正在進行 於是嘗試用css實現了一下。首先需要建立用來表示小球的html結構 div class container div class circle c1 div div class circle c2 ...