My pager has one webview inside each fragment. The webviews themselves don't scroll, i.e. their content fit entirely in them.
The problem is the scrolling of the pager doesn't behave as expected. The webview content only follows the scrolling when going through the right edge of the screen (i.e. moving out/in to/from the right). When a webview is going through the left edge though it's content stays still (so that it looks like the next page is sliding over it, like cards).
I tried having other components (TextView, ImageView) along with the WebView on each page. They all slide normally while the WebView content keeps getting stuck on the left.
Is this a known problem? Is there a workaround?
Turns out the issue was CSS related.
I had "position:fixed" on all web content. After changing it to "absolute" the problem was solved.
In my point of view it's still an unexpected behavior, because "fixed" is supposed to position things relative to the browser window. What is expected is that, as the webview is scrolled left, the "browser window" moves past the device screen.
Related
I have been researching for the same since two days. Here is what i want to achieve. I havent ever tried much animations in android so please clear my approach wherever required. I will have two pages/screens (one visible at a time) Now when I am on page1, on swiping right to left page 2 will be displayed (achieving this is not that difficult) But here is my problem : when I am scrolling to page2 i would like to animate/translate/slide an image from page1 to page2 (without touching the image) and let the image sit on page2. I am just not sure of how to start with this.
I have thought of few ideas
First: I think i should implement a layout larger then window and then do the required animations and scrolling in it using horizontal scrollview.But now here I am not sure how will I make it look like they are 2 different pages(concerned about handling different screen sizes)
Second:I have seen example libraries of draggable gridview viewpager. But here both of my pages will have different layouts
Third:I am thinking of dividing both of my pages. the lower part of my pages will contain framelayout where I will only change the framelayout's content on scroll and perform hide n show trick on the upper part.But here again the trick is how am I supposed to place the image(contained in framelayout) to upper layout with an animation(image sliding to the top side on its own kind of animation)
Any Ideas. Any views/suggestions. Need all of it.Thank You for your valuable time.
This happens when I am trying to move the image to screen's top-left position. It moves in the left top direction as shown in the images below..
This happens when I am trying to move it besides second fragment textview
But the problem is I want to move it besides second fragment textview while scrolling and when scrolling is done it should come to top left of the screen just like the second fragment textview
On scrolling down gridView.
I want to scroll my three tabs on top as shown in second image.
And on scrolling up back shows that again like first image.
I have checked paralloid library, but not sure if it solves this problem or not.
Same functionality i found in google+ android app. In profile page on scrolling tab scroll till they reach on top. after that list view scrolls.
GridView already has scrolling built into it, so its children should scroll separately than its siblings by default. No extra library should be needed for scrolling down, although scrolling horizontally is a separate issue.
I have an android app with ViewPager from the support library.
Inside fragment's view, I have some Views on top and a WebView with some HTML contents below them.
First page is loaded properly, but when switching between pages, every next page automatically scrolls down to the webview and focuses something in it (image, hyperlink) marking it with a default style (orange color on my phone). This is extremely weird, I don't know where it comes from and I want to get rid of this behavior. Each page should be on its top (scroll position 0) when opened.
It happens with a short latency after loading view (onCreateView), so setting scroll position to 0 in onCreateView did not help.
After sliding to another page, it should look like this:
good version http://imageshack.us/a/img254/4623/shotgood.png
But after approx. a second, it automatically scrolls down, focuses a link and looks like this:
bad version http://imageshack.us/a/img855/1848/shotbad.png
Anyone experienced such issue and knows solution?
Thanks in advance.
EDIT: I have noticed that this issue does not occur while I don't scroll vertically inside any fragment. After I scroll vertically and then slide to another page, it starts to happening on every next page.
After few days of searching, I've finally found solution described here:
Webview inside a View pager in android
point is adding
android:descendantFocusability="blocksDescendants".
to the outer-most linear layout.
I've made an activity that looks a lot like the level select screen from angry birds: there is a grid of button, and you can scroll through pages of them by swiping right or left.
I built it by creating a layout of the buttons, and then adding those layout to a Gallery view.
The problem is the animation is jerky, even if you swipe extra slowly, the content jumps ahead. Even when you fling the gallery page, it skips and jumps along its way to its destination.
I am wondering how to fix this: Maybe the complex layout it making it non responsive during the inflate?
Do you know how to fix this, or of a good way to do a workaround using some other approach that will let me have 3 or more screens smoothly swiping from page to page?
You should be using ViewPager. This is available in android support packages. Gallery Widget will not be smooth if you add components into it which has a lot of touch actions.
http://android-developers.blogspot.in/2011/08/horizontal-view-swiping-with-viewpager.html
I have a view hierarchy like this, a vertical ScrollView with a vertical LinearLayout containing two children:
ScrollView ->orientation:vertical, width:fill_parent, height: fill_parent
LinearLayout -> orientation:vertical, width:fill_parent, height: fill_parent
WebView -> width:fill_parent, height: fill_parent
GoogleAdView -> width:wrap_content, height:wrap_content
When scrolling to the bottom of the webview and clicking on any link there, though the page loads , the scrollbar stays at the bottom rather than moving to the top. I can programatically set the scroll using scroll.fullScroll(ScrollView.FOCUS_UP), but that causes the scrollbar to jump up visibly. I have tried hiding the scrollbar before the page loads with scrollView.setVerticalScrollBarEnabled(false) and then re-enabling it after the page loads before calling scroll.fullScroll(ScrollView.FOCUS_UP) but that still causes the scrollbar to "jump".
The WebView by itself handles scrolling much more nicely on page changes, looks like it hides the scrollbar and then makes it appear on top of the page after load. Is there a way to maintain this with ScrollView?
You cannot reliably put a WebView in a ScrollView.
Either embed your ad in your Web content, leave the banner fixed on the screen, or work out some other trigger to animate hiding the ad (e.g., goes away after 5 seconds).
I've solved this by adding the AD inside the webview. Unfortunately you won't be able to use any Ad network SDK's, but it's a much better user experience.
Use javascript injection to insert your ads after the webview loads.
The trick is to use loadDataWithBaseURL when loading content into the WebView. Simply doing a loadData doesn't cause the scroll offset to reset.