Android hover button click to return to the top floatingactionbutton

Let's take a look at the effect of clicking the Android hover button back to the top:

Floatingactionbutton is a control provided in the design support library. This control can easily realize the effect of floating buttons

First, to use the hover button in the project, you must first import the design package into the project gradle and add dependencies

compile 'com.android.support:design:25.0.0'

The next step is to use it in XML: Here I put a listview simulation to return to the top

Where app: elevation = "10dp" is to specify a height for the floatingactionbutton. The higher the height, the larger the projection range, but the lighter the projection effect. Otherwise, it will be reversed

Next is the use in mainactivity:

How about it? Easy.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>