Soru & Cevap

Label Font Değiştirme ...

19.09.2016 - 02:15

Mrb. arkadaşlar.

Android studio üzerinde oyun kodları düzenlemeye çalışıyorum.

Oyun içerisindeki yazıların fontlarını skin dosyasından çekiyor.

Bunun yerine Arial vs gibi font eklemem için nasıl yapmam gerekiyor. Kodlar aşağıdaki gibidir.

Şimdiden teşekkür ederim

@Override
    public void create() {
        super.create();
        previousScreen = menu;
        
        final Label descriptionTitleLabel = new Label(descriptionTitle, skin);
        descriptionTitleLabel.setColor(Color.ORANGE);    
        final Label descriptionTextLabel = new Label(descriptionText, skin);
        descriptionTextLabel.setWrap(true);
        
        final Label objectivesTitleLabel = new Label("\n" + objectivesTitle, skin);
        objectivesTitleLabel.setColor(Color.YELLOW);    
        final Label objectivesTextLabel = new Label(objectivesText, skin);
        objectivesTextLabel.setWrap(true);
        
        final Label elementsTitleLabel = new Label("\n" + elementsTitle, skin);
        elementsTitleLabel.setColor(Color.YELLOW);    
        final Label elementsTextLabel = new Label(elementsText, skin);
        elementsTextLabel.setWrap(true);

        descriptionTitleLabel.setFontScale(0.9f);
        objectivesTitleLabel.setFontScale(0.9f);
        descriptionTextLabel.setFontScale(0.75f);
        objectivesTextLabel.setFontScale(0.75f);
        elementsTitleLabel.setFontScale(0.75f);
        elementsTextLabel.setFontScale(0.75f);

        final Table tableBody = new Table();
        tableBody.defaults().fill().expand();
        tableBody.add(descriptionTitleLabel);
        tableBody.row();
        tableBody.add(descriptionTextLabel);
        tableBody.row();
        tableBody.add(objectivesTitleLabel);
        tableBody.row();
        tableBody.add(objectivesTextLabel);
        tableBody.row();
        tableBody.add(elementsTitleLabel);
        tableBody.row();
        tableBody.add(elementsTextLabel);
        
        final ScrollPane scroll = new ScrollPane(tableBody);        
        root.add(scroll).fill().expand();
        root.pad(0f, 10f, 0, 10f);
        root.setBackground(skin.getDrawable("dialogDimMediumAlpha"));
    }
        
}

 

17 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user koraysari1996
koraysari1996
14.12.2019 - 11:24

selamlar,
https://stackoverflow.com/questions/16404820/how-to-set-default-font-family-for-entire-android-app
burdaki cevaplar sana yardımcı olabilir.