最近、多色フォントに関するトラブルが発生しています。私が持っているフォントは白と黒の色を使用していますが、何らかの理由で黒しか表示されておらず、内側の白が表示されていません。私は何か間違ったことをしたか、そこにフォントの色をつける方法がありますか?ありがとうございました。ここでは、コードである - またカスタムフォントが1つの色だけで正しく表示されない
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/editundo.otf");
//crating color fill and adding in font to the paint and setting the color fill white and text size 150
Paint paint = new Paint();
paint.setTypeface(tf);
paint.setTextSize(150);
// do other setup on Paint object
// Draw all the text stuff
//if the screen has not been tapped touch screen to start
if (f == 0) {
canvas.drawText("Tap to Start", MainActivity.screenWidth/4, MainActivity.screenHeight/2, paint);
}
//Setting text as 40 size and draw the score text
paint.setTextSize(40);
canvas.drawText("Score: " + score, 10, 50, paint);
canvas.drawText("High Score: " + HighScore, 10, 120, paint);
paint.setTextSize(35);
canvas.drawText("Car Tokens: " + coinz, MainActivity.screenWidth*7/9+MainActivity.screenWidth*2/100, 50, paint);
、私が使用していたフォントは、Mouser初のアウトラインフォントである、と私は.OTFとの.ttfの両方としてそれを使用しています。フォントへのリンクはここにあります - http://fontzone.net/font-details/mouser-outline
ありがとうございました。
あなたがする必要があるのは、あなたのペイントオブジェクトの色を設定することだけです: 'paint.setColor(Color.WHITE)' –
私はそれを試みました。それはうまくいかず、内側の部分も白くしたい。 –