【问题标题】:External Hyperlink with a libgdx actor带有 libgdx 演员的外部超链接
【发布时间】:2014-10-29 08:52:18
【问题描述】:

我想在点击时重定向到 Facebook、Instagram 和粉丝专页的舞台上的一些形象演员。我在网上搜索,但找不到任何可以帮助我做到这一点的东西。谁能给我一些关于我需要做什么的指示。

    facebookLogo = new Image(skinMenu, "FacebookLogo");
    facebookLogo.setBounds(400, 20, 30, 30);
    facebookLogo.addListener(new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
            //Go to Facebook page
            return true;
        }
    });
    layer.addActor(facebookLogo);

    instagramLogo = new Image(skinMenu, "InstagramLogo");
    instagramLogo.setBounds(440, 20, 30, 30);
    instagramLogo.addListener(new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
            //Go to Instagram page
            return true;
        }
    });
    layer.addActor(instagramLogo);

    webLogo = new Image(skinMenu, "WebLogo");
    webLogo.setBounds(480, 20, 30, 25);
    webLogo.addListener(new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
            //Go to website
            return true;
        }
    });
    layer.addActor(webLogo);

【问题讨论】:

    标签: facebook url libgdx actor stage


    【解决方案1】:

    输入“Gdx”后。让eclipse补上,我找到了答案。

    Gdx.net.openURI("http://

    它使用默认浏览器打开链接。

    您只需将其粘贴在 InputListener 的触地事件中

    webLogo.addListener(new InputListener() {
            public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
                Gdx.net.openURI("http://<web page");
                return true;
            }
        });
        layer.addActor(webLogo);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-27
      • 2012-11-15
      • 2015-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多