GWT - hide horizontal scrollbar

I'm wondering ... Is there a way to hide the horizontal scrollbar with the GWT ScrollPane standard ? I mean, maybe not using external CSS styles, etc.? Or can you recommend a more optimal way to achieve the effect?

... And as for CSS, right now I tried to set such a style for my ScrollPane

.a-scroll {
overflow-y: scroll;
overflow-x: hidden;
}

... but it seems like it is not working, and the horizontal scrollbar is still visible: S So is there a workaround?

thank

+5
source share
3 answers

ScrollPanel overflow auto (.. ), - . , . , scrollPanel.setAlwaysShowScrollBars(false) , ( initialize()).

, .

, overflow-x: hidden ScrollPanel ( , div overflow ). :

public class MyScrollPanel extends ScrollPanel {

  public void setAlwaysHideHorizontalScrollBar(boolean alwaysHide) {
    getScrollableElement().getStyle().setOverflowX(alwaysHide ? Overflow.HIDDEN : Overflow.AUTO);
  }
  // ... and the like.
}

, , . overflow-x/y CSS3, overflow - CSS2. , .

CSS , , - .

Anothe CustomScrollPanel, , , , , , ( , ).

, div (, SimplePanel) , , .

+6

, , , , . , , , , .

scrollPanel.setAlwaysShowScrollBars(false);
scrollPanel.setWidth("normalwidth + 8px");

.

+1

You can hide the scroll bars if the content does not overflow the container using

scrollPanel.setAlwaysShowScrollBars(false);

If your scrollbars are still displayed, you can view your content.

0
source

All Articles