In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how Android imitates the Wechat startup state of Nine Miyagi grid drag and delete function, the editor thinks it is very practical, so share it with you as a reference, I hope you can get something after reading this article.
1. Perfect 1: 1 imitates Wechat and imitates Wechat to post trends. Drag and delete nine grid.
There is a problem with dragging ui violently, which does not affect the use. Find a + sign for the resource file yourself.
2. Wechat sends dynamic drag and drop bug.
When you select a picture and press the home keyboard while dragging the picture, you cannot click on the input text when you enter it again. When you click on the input text, the event of selecting an album will be triggered.
3. Basequickadapter for drag and drop events
Implementation 'com.android.support:recyclerview-v7:28.0.0' implementation "com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50" implementation "com.github.bumptech.glide:glide:4.9.0"
4. Get started quickly
Activity NineGridChooseImage nineGridChooseImage = findViewById (R.id.nineGridChooseImage); FrameLayout frameLayout= findViewById (R.id.frameLayout); nineGridChooseImage.init (frameLayout); int statusBarHeight = 0; int resourceId = getResources (). GetIdentifier ("status_bar_height", "dimen", "android"); if (resourceId > 0) {statusBarHeight = getResources (). GetDimensionPixelSize (resourceId);} nineGridChooseImage.setFixH (statusBarHeight) / / check the height of nineGridChooseImage.setAddClick (new NineGridChooseImage.AddClick () {@ Override public void onAdd () {/ * List list = new LinkedList (); for (int I = 0polii0) {mTempImage.setX (rect.left); mTempImage.setY (rect.top-mFixH);} else {mTempImage.setX (lastRect.left + dX); mTempImage.setY (lastRect.top-mFixH + dY);} mTempImage.getGlobalVisibleRect (rect); if (SCREEN_H-bottomViewH)
< rect.bottom) { isDel = true; trash.setBackgroundResource(R.drawable.base_trash_open); } else { isDel = false; trash.setBackgroundResource(R.drawable.base_trash_close); } } } public void addData(String path) { mDraggableAdapter.addData(0, path); mDraggableAdapter.notifyItemChanged(mDraggableAdapter.getData().size()-1); } public void addData(List path){ int size = mDraggableAdapter.getData().size(); int offset = mImageCount - size + 1; if(offset >Path.size () {offset = path.size ();} mDraggableAdapter.addData (0, path.subList); mDraggableAdapter.notifyItemChanged (mDraggableAdapter.getData (). Size ()-1);} public void setImageCount (int mImageCount) {this.mImageCount = mImageCount;} public void setAddClick (AddClick mAddClick) {this.mAddClick = mAddClick;} public void setDragCallBack (DragCallBack mDragCallBack) {this.mDragCallBack = mDragCallBack } / * get list * * @ return * / public List getData () {List res = new LinkedList (); for (int I = 0; I < mDraggableAdapter.getData (). Size ()-1; iTunes +) {res.add (mDraggableAdapter.getData (). Get (I));} return res;} / * * enter * / private void in () {mBottomView.setVisibility (View.VISIBLE) at the bottom ObjectAnimator animator = ObjectAnimator.ofFloat (mBottomView, "translationY", 0) .setDuration; animator.start ();} / * * bottom remove screen exterior * / private void out () {final int moveX = DisplayUtil.dpToPx (55); ObjectAnimator animator = ObjectAnimator.ofFloat (mBottomView, "translationY", moveX) .setDuration (200); animator.addListener (new AnimatorListenerAdapter () {@ Override public void onAnimationEnd (Animator animation) {super.onAnimationEnd (animation); mBottomView.setVisibility (View.GONE)) Trash.setBackgroundResource (R.drawable.base_trash_close);}}); animator.start ();} public interface AddClick {void onAdd ();} public interface DragCallBack {void onStart (); void onEnd ();}}
Iamge_item.xml
This is the end of the article on "how Android imitates Wechat's startup state of Ninomiya drag and delete function". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.