private void setSP(ScrollPane sp) {
   ScrollPaneStyle aux_st = sp.getStyle();
   TextureRegion bg = new TextureRegion(Textures.scroll_box_bg, 0, 0, 256, 512);
   TextureRegionDrawable bg_d = new TextureRegionDrawable(bg);
   aux_st.background = bg_d;
   aux_st.vScroll = null;
   sp.setStyle(aux_st);
   sp.setHeight(415);
   sp.setWidth(212);
   sp.setSmoothScrolling(true);
   sp.setFadeScrollBars(true);
   sp.setFlickScroll(false);
   sp.setScrollbarsOnTop(true);
   sp.setupFadeScrollBars(2, 1.5f);
 }
Beispiel #2
0
 @Override
 public void create() {
   stage = new Stage(480, 800, false);
   group = new Group();
   group.setSize(256 * 30, 256); // 横向滚动条
   //		group.setSize(256, 512*30);//纵向滚动条
   images = new Image[30];
   int i;
   for (i = 0; i < 30; ++i) {
     images[i] = new Image(new Texture(Gdx.files.internal("data/lengjiao.png")));
     //			images[i] = new Image(new Texture(Gdx.files.internal("data/test1.jpg")));
     images[i].setPosition(i * 256, 0); // 横向滚动条
     //			images[i].setPosition(0, i*512);//纵向滚动条
     group.addActor(images[i]);
   }
   style = new ScrollPaneStyle(); // 初始化一个ScrollPaneStyle
   style.background = null; // 把背景设成null,即这个滚动条不需要背景
   pane = new ScrollPane(group, style);
   pane.setSize(480, 256); // 横向滚动条
   //		pane.setScrollingDisabled(false, true);//设置是否可上下、左右移动..这里设置了横向可移动、纵向不可移动..
   //		pane.setSize(256,800);
   stage.addActor(pane);
   Gdx.input.setInputProcessor(stage);
 }