0
无论我做什么,标签都是半透明的。 表中的标签(labelA,labelB,labelC
)最初为0%透明,但只要您将其文字设置为labelA.setText("sometext");
,它们就会像他们的兄弟labelWarning
一样变得透明。 labelWarning
一直是半透明的。我试图把它加入到没有一个组的舞台上(stage.addActor(labelWarning);
),更改它的a
由labelWarning.getColor().a=1;
但没有区别!期待你的帮助无法阻止libgdx scene2d/ui/Label半透明
Label.LabelStyle ls=new
Label.LabelStyle(screenGame.getFont(),Color.BROWN);
Label labelA=new Label("700 metre",ls);
Label labelB=new Label("700 metre",ls);
Label labelC=new Label("1500 metre",ls);
labelWarning=new Label("sd",ls);
labelWarning.setWrap(true);
labelWarning.setPosition(50,30);
labelWarning.setWidth(500);
labelWarning.setAlignment(Align.top);
tableEPS=new Table();
//tableEPS.debug();
tableEPS.row();
tableEPS.add(epgrass).pad(10f);
tableEPS.add(epdesert).pad(10f);
tableEPS.add(epsnow).pad(10f);
tableEPS.row();
tableEPS.add(labelA);
tableEPS.add(labelB);
tableEPS.add(labelC);
tableEPS.row();
tableEPS.setFillParent(true);
tableEPS.pack();
episodesGroup=new Group();
episodesGroup.setSize(worldwidth,worldheight);
episodesGroup.addActor(imagebgclouds);
episodesGroup.addActor(backbutton);
episodesGroup.addActor(tableEPS);
episodesGroup.addActor(labelWarning);
stage=new Stage(screenGame.getViewport());
stage.addActor(episodesGroup);
没有工作,我甚至在'labelWarning.setText(“sometext”);'之前和之后添加'labelWarning.setColor(16,14,119,1)'',为'labelWarning'创建了不同的LabelStyle ,还是一样,半透明:( – user2624687
颜色是在0-1的比例,而不是0-255。 – Tenfour04
我照你说的做了,并没有帮助。但是,我碰巧发现,我通过spriteBatch绘制的字体是半透明也是如此,但是如你所说设置颜色使得它们不透明,并且在设置正常颜色之后我必须设置rgba颜色以便发生这种情况。'batch.begin(); font.setColor(Color.WHITE); font.setColor (1,1,1,1.0f); font.draw(batch,“fps:”+(int)(1f/delta),0,50); batch.end();'我加了''font .setColor(1,1,1,1.0f);'没有这行这个fps文本也是半透明的,'labelWarning'是仍然是同一半透明 – user2624687