Web Learners, This blog is gonna give you huge knowledge about Mobile App Development, Game development, Internet Marketing, Social Network Marketing, Search Engine Optimization (SEO) ,Mobile Marketing, and website and web application Code knowledge such as HTML, CSS, JavaScript etc. This site is also gonna give you free tools and software with installation guides. Most important Tips and tricks about marketing, software installation and Coding is always available.
First, we will write code in "activity_main.xml" file, we will take a "SwipeRefreshLayout" above our Webview, and we will close it below "Webview".
swiperefreshlayout width and height will match_parent, and you need to give a id, I am giving id is "swipe".
Code:
We have finished coding in "activity_main.xml" file. So, the whole code will be in activity_main.xml file is :
Code:
Now we will move to "MainActivity.xml" file. First we will take a private SwipeRefreshLayoutvariable, will give the name "swipeRefreshLayout".
Code:
After that, in "onCreate" function we need to retrieve swiperefreshlayout design from activity_main.xml file and store it to swiperefreshlayout variable which we have taken above.
And Also you need to call onRefreshListener and I will give custom color for SwipeRefreshLayout, you can use default color also. See below code:
Code:
We have finished writing code for "Pull to Refresh". So, the whole code will be in MainActivity.java is:
Code:
Now we will run our project.
as you can see my screenshot we have successfully added pull to Refresh function in our Webview app. Thanks.
I am nothing but a online business man. more than 12 years of experiences in online business. I have learned everything of my own. You know if you learn something from your own you will learn more than somebody taught you on that topic. Long story short, I did lots of experiments, did lots of online jobs for the people, got lots of errors changes the way again and again. At the end got the perfect knowledge about online business. I would love to let you know all of my 12 years of knowledge about online business. Keep in touch with the blog to be knowledged about online business.
Thanks
, click here →
bidvertiser
About Site
WebLearners is a blog to teach online business such as E-com Business, App Business, SEO Business, Digital Marketing, etc. Lots of free tools and web applications will be given for free. Actually, We will dig deep on every topic one by one. It will be a long journey but in the end, you will be a succesful online businessman. Tutorials are expressed as a guideline for the person who wishes to start an online business. Readers can ask any questions or can ask for help to develop their business. We will be happy to help.
, click here →
How to Enable Download in Android Webview App? In the Last post of our Webview Series, I have shown How to Add Splash Screen in Any Androi...
bidvertiser
About Me
I am nothing but a online business man. more than 12 years of experiences in online business. I have learned everything of my own. You know if you learn something from your own you will learn more than somebody taught you on that topic. Long story short, I did lots of experiments, did lots of online jobs for the people, got lots of errors changes the way again and again. At the end got the perfect knowledge about online business. I would love to let you know all of my 12 years of knowledge about online business. Keep in touch with the blog to be knowledged about online business.
Thanks
, click here →
Erro on import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
ReplyDeleteBut mam It is showing error <androidx.swiperefreshlayout.widget.SwipeRefreshLayout not found
ReplyDeleteYou need to add swiperefreshlayout dependency in your gradle file, like implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
Delete