Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the springback effect of sliding and loosening the background image by Android

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "Android how to achieve the background image sliding larger release rebound effect", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Android how to achieve the background image sliding larger release rebound effect" bar!

Original drawing

After magnification

1. Custom view inherits ScrollView implementation effect

Public class HeadZoomScrollView extends ScrollView {whether the position where the private View mZoomView; private int mZoomViewWidth; private int mZoomViewHeight; private float firstPosition;// record was pressed for the first time is private boolean isScrolling;// scaling private float mScrollRate = 0.3f super / scaling factor. The larger the zoom factor is, the greater the change is. The larger the zoom factor is, the slower the callback is public HeadZoomScrollView (Context context) {super (context). } public HeadZoomScrollView (Context context, AttributeSet attrs) {super (context, attrs);} public HeadZoomScrollView (Context context, AttributeSet attrs, int defStyleAttr) {super (context, attrs, defStyleAttr);} public void setmZoomView (View mZoomView) {this.mZoomView = mZoomView;} public void setmScrollRate (float mScrollRate) {this.mScrollRate = mScrollRate;} public void setmReplyRate (float mReplyRate) {this.mReplyRate = mReplyRate } @ Override protected void onFinishInflate () {super.onFinishInflate (); init ();} private void init () {setOverScrollMode (OVER_SCROLL_NEVER); if (getChildAt (0)! = null) {ViewGroup vg = (ViewGroup) getChildAt (0); if (vg.getChildAt (0)! = null) {mZoomView = vg.getChildAt (0) @ Override public boolean onTouchEvent (MotionEvent ev) {if (mZoomViewWidth)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report