Remove scroll bar track from ScrollView in Android?

I'm a little confused why you are putting a WebView into a ScrollView in the first place. A WebView has it's own built-in scrolling system.

Up vote 1 down vote favorite 1 share g+ share fb share tw.

My Android app has a main WebView (HTML loaded from a local resource) which I want to use the entire width of the screen and be able to make (vertically) scrollable. So I've wrapped the WebView in a ScrollView in my layout XML, but no matter what I do I can't seem to be able to remove the scroll bar track from the right side of the scroll view. Even worse, I can't seem to be able to change the background colour of the scroll bar track.

The track takes up about 10dp's or so, which is creating problems for the HTML in the WebView. I'd like the scroll bar to appear on top of the web view (iPhone style, if you know what I mean). Now, you could say "why don't you change your HTML to be 10px thinner?

", which is my fallback solution, but I'd much rather not have to. Here's the relevant snippet of layout XML, you'll see I've tried every android:etc attribute I could find: I'm targeting platform 2.1 / API lvl 7, really just dealing with normal size displays, mdp, hdp and xhdp. Android android-layout scrollview android-scrollbar link|improve this question asked Jun 8 '11 at 1:29Mick Byrne198214 89% accept rate.

I'm a little confused why you are putting a WebView into a ScrollView in the first place. A WebView has it's own built-in scrolling system. Regarding your actual question, if you want the scrollbar to show up on top, you can use view.

SetScrollBarStyle(View. SCROLLBARS_INSIDE_OVERLAY) or android:scrollbarStyle="insideOverlay.

Yes, you're right about not needing the ScrollView in the first place, I worked that out myself before checking back here. The 'setScrollBarStyle' on the web view worked a treat, thanks! – Mick Byrne Jun 8 '11 at 2:06.

To remove a scrollbar from a view (and it's subclass) via xml: android:scrollbars="none" developer.android.com/reference/android/....

Try this is your activity onCreate: ScrollView sView = (ScrollView)findViewById(R.id. Deal_web_view_holder); // Hide the Scollbar sView. SetVerticalScrollBarEnabled(false); sView.

SetHorizontalScrollBarEnabled(false); http://developer.android.com/reference/android/view/View.html#setVerticalScrollBarEnabled%28boolean%29.

Thanks... I'd tried that one already (in code and in the layout. Xml), but this approach still interfered with the horizontal size of the WebView within the ScrollView. The best solution was the one provided above, just removing the ScrollView altogether and allowing the WebView to handle the scrolling itself.

The root problem was my lack of understanding of how when it was appropriate to use a ScrollView at all; i.e. Every view in Android can handle scrolling. – Mick Byrne Jun 9 '11 at 23:06.

To remove a scrollbar from a view (and it's subclass) via xml.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions