android-typeface

Any way to setTypeFace from url for a Textview?

人盡茶涼 提交于 2020-02-02 16:24:06
问题 I want to setTypeFace from url like : https://github.com/anak10thn/frontend-homepage/raw/master/font/helvetica-regular.otf Do you know if there any way ? I tried this : Typeface tf = Typeface.createFromFile("https://github.com/anak10thn/frontend-homepage/raw/master/font/helvetica-regular.otf"); tv.setTypeface(tf); It doesn't work. I have this error : 03-24 04:46:59.931 1314-1314/bya.fchps.buildyourapp E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: bya.fchps.buildyourapp, PID: 1314 java.lang

Any way to setTypeFace from url for a Textview?

淺唱寂寞╮ 提交于 2020-02-02 16:21:24
问题 I want to setTypeFace from url like : https://github.com/anak10thn/frontend-homepage/raw/master/font/helvetica-regular.otf Do you know if there any way ? I tried this : Typeface tf = Typeface.createFromFile("https://github.com/anak10thn/frontend-homepage/raw/master/font/helvetica-regular.otf"); tv.setTypeface(tf); It doesn't work. I have this error : 03-24 04:46:59.931 1314-1314/bya.fchps.buildyourapp E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: bya.fchps.buildyourapp, PID: 1314 java.lang

Are Android monospace fonts actually fixed size?

依然范特西╮ 提交于 2020-01-06 15:25:15
问题 I am using the Android Monospace font for my game and have found that the font does not behave as expected. The game relies on the top characters and the underscores below being lined up with each other as clues to solve the cryptogram. However when the word is very close to the edge of the TextView as can be seen on the 5th line shown in the image the blue line of text goes onto the next line causing the clues and answers to be out of sync. I'm using TextView.setTypeface(Typeface.MONOSPACE)

canvas.drawText with pixel perfect text on a canvas

半腔热情 提交于 2019-12-23 05:36:09
问题 THIS IS NOT ABOUT AntiAlias, Please read the question before answering thank you. ADDING BOUNTY TO--> android convert text width (in pixels) to percent of screen width/height Quality info --> https://stackoverflow.com/a/1016941/1815624 I am getting inconsistent results when trying to draw text on a canvas. Please help, thank you. I want the text to consume the same amount of scaled space on all devices I do not care about ANTI_ALIAS and have added the paint.setFlags(Paint.ANTI_ALIAS_FLAG);

Android Notification: add typeface for title and content

﹥>﹥吖頭↗ 提交于 2019-12-22 08:57:42
问题 I'm trying to add a Typeface in my NotificationCompat.Builder -> setContentTitle() and setContentText() . I initialized Typeface by Typeface banglaFont = Typeface.createFromAsset(this.getAssets(), "kalpurush.ttf"); in IntentService . To create Notification i used following code. NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( this) .setLargeIcon(bitmap) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(userName) .setAutoCancel(true) // .setStyle( // new

Changing font in android app crashes the application - native typeface cannot be made

◇◆丶佛笑我妖孽 提交于 2019-12-22 00:35:48
问题 I am trying to include a customized font in my android application. This is the tutorial that I followed and this seems to have worked for many people: http://tharindudassanayake.wordpress.com/2012/02/25/use-sinhala-fonts-for-your-android-app/ This is how I have tried it: XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >

custom font in Android Studio

那年仲夏 提交于 2019-12-21 20:54:45
问题 How to create custom fonts in android studio ? Im trying to use a custom font, and I've read that I suppose to place the fonts in assets/fonts. I have searched long and hard but found nothing that helped yet. Where I wrong? I really do not know what to do. I wrote all the details below. I've tried and did not succeed. I'm using Android Studio and it doesn't seem like I have a assets folder. So I created one. But my app crashes when I place the assets folder in /main/assets. Im using this code

How to use support library fonts feature as a part of the TextView content (using spannable)?

余生颓废 提交于 2019-12-18 05:52:29
问题 Background The support library (docs here) allows you to use TTF fonts files in the "res/font" folder, either in XML : app:fontFamily="@font/lato_black" or via code: val typeface = ResourcesCompat.getFont(context, R.font.lato_black) The problem While I know it's possible to use spannable technique to set different styles in parts of the TextView content (such as bold, italic, colors,etc...) , the only thing I've found for setting a different font, is by using the built in fonts of the OS, as

How to use support library fonts feature as a part of the TextView content (using spannable)?

白昼怎懂夜的黑 提交于 2019-12-18 05:52:14
问题 Background The support library (docs here) allows you to use TTF fonts files in the "res/font" folder, either in XML : app:fontFamily="@font/lato_black" or via code: val typeface = ResourcesCompat.getFont(context, R.font.lato_black) The problem While I know it's possible to use spannable technique to set different styles in parts of the TextView content (such as bold, italic, colors,etc...) , the only thing I've found for setting a different font, is by using the built in fonts of the OS, as

Is it possible to have multiple Typefaces in the same TextView?

怎甘沉沦 提交于 2019-12-18 03:35:12
问题 I know how to change text attributes and color for a TextView , but is it possible to have multiple Typefaces in the same TextView ? For instance, can I use both Droid Sans and Droid Mono in the same TextView at the same time? If so, how? 回答1: Actually it looks like you can do it with the help of a Spannable: String text = "This is an example"; Spannable s = new SpannableString(text + " text"); s.setSpan(new TypefaceSpan("monospace"), 0, text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); s