gpt4 book ai didi

android - LIBGDX : add a clickable text link

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:37:26 33 4
gpt4 key购买 nike

我正在用 libgdx 开发一个小游戏,在我的关于屏幕上我想要一个标签(包裹在一个表格中),其中会有一个可点击的文本链接(带下划线或不同颜色),如下所示:

你可以在这里查看代码

here

编辑:

我试过的是:

HorizontalGroup monGroup = new HorizontalGroup();
Label howRotationRep = new Label("They have been based on the information provided on this ", new Label.LabelStyle(game.petiteFont, Color.WHITE));
howRotationRep.setWrap(true);
howRotationRep.setWidth(tailleCell);

Label test = new Label(" site", new Label.LabelStyle(game.petiteFont, Color.RED));
test.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {

Gdx.net.openURI("http://tetrisconcept.net/wiki/SRS");

}
});
monGroup.addActor(howRotationRep);
monGroup.addActor(test);
table.add(monGroup).left().width(tailleCell);

它给了我这个

this

最佳答案

如果您只需要标签的一部分可点击,我认为最好的实现方式是使用两个标签,这应该可行:

    Label lblReviewCode = new Label("You can review the code ", skin);
Label lblReviewCodeLink = new Label("here", skin, "linkstyle");
// If you don't want to provide a custom style...
//Label lblReviewCodeLink = new Label("here", skin);
lblReviewCodeLink.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
Gdx.net.openURI("https://bitbucket.org/batman3000/batris");
}
});
// If you didn't provided the style, you can at least paint it blue by doing this...
//lblReviewCodeLink.setColor(Color.BLUE);

HorizontalGroup codeLink = new HorizontalGroup();
codeLink.addActor(lblReviewCode);
codeLink.addActor(lblReviewCodeLink);

table.add(codeLink);

关于android - LIBGDX : add a clickable text link,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27294145/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com