Currently, I have a webView
with custom relativeLayout
header, and when I scroll up, the webView
the header should be hidden.
And when I scroll down the header should be visible.
Please suggest me any idea about.
Currently, I have a webView
with custom relativeLayout
header, and when I scroll up, the webView
the header should be hidden.
And when I scroll down the header should be visible.
Please suggest me any idea about.
You will have to implement scroll listener for that. see this
After implementing scroll listener for webview, you will get two conditions (up scroll & down scroll).
so, hide your relative layout header on scroll down and show it on scroll up.
wv.setOnScrollChangedCallback(new OnScrollChangedCallback(){
public void onScroll(int l, int t, int oldl, int oldt){
if(t> oldt){
header.setVisibility(View.VISIBLE);
}
else if(t< oldt){
header.setVisibility(View.GONE);
}
}
});
You can also make an animation transition for the same for the better user experience.
wv.setOnScrollChangedCallback(new OnScrollChangedCallback(){
public void onScroll(int l, int t, int oldl, int oldt){
if(t> oldt){
header.setVisibility(View.VISIBLE);
}
else if(t< oldt){
header.setVisibility(View.GONE);
}
}
});
when i implement this code then at the time of scrolling both condition are executing.that's why its showing visible and gone at the same time.