android-typeface

Text (font) looks faded on older apis

血红的双手。 提交于 2019-12-05 07:03:23
I am using a custom typeface, and it displays perfectly on newer android versions(tested on API 17(Asus tab), 18(Dell tab), 19(Nex4) - devices). However, the same typeface looks faded (possibly distorted?) on older versions - API 8(SE X10i), 10(LG P500H). Here's a comparison, in case my explanation doesn't make sense: On nex4: On x10i: I am using a custom typeface with Typeface.BOLD: tvTitle.setTypeface(titleAndBodyFont, Typeface.BOLD); And the body ("Looks *" part): tvBody.setTypeface(titleAndBodyFont); XML declaration for title: <TextView android:id="@+id/tvTitle" android:layout_width="match

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

醉酒当歌 提交于 2019-12-04 19:52:39
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" > <TextView android:id="@+id/sinhala_font" android:layout_width="fill_parent" android:layout_height="wrap

how to set Android Typeface from xml

感情迁移 提交于 2019-12-04 16:40:09
Typeface fontRobo = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Black.ttf"); viewTotalValue.setText(total.toString()); You could create your own TextView by overriding the TextView like this: public class MyTextView extends TextView { public MyTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setType(context); } public MyTextView(Context context, AttributeSet attrs) { super(context, attrs); setType(context); } public MyTextView(Context context) { super(context); setType(context); } private void setType(Context context){ this

custom font in Android Studio

时光毁灭记忆、已成空白 提交于 2019-12-04 14:49:26
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 to load my fonts. I know that . structure for a project in Android Studio 0.5.2: root-module |--.idea

Edittext Fonts Are Not Displaying

谁都会走 提交于 2019-12-04 03:49:15
问题 I'm going through a weird problem. I have created CustomEdittext class for setting Typeface for whole application and it works successfully in nearly all cases. I am using circo.ttf The problem is that when I set android:inputType="textPassword" , text stops displaying after typing, maybe because the font doesn't have a password symbol or maybe there is some other problem. Below is an example of my issue : CustomEdittext.java public class CustomEdittext extends EditText { public

How do I specify eg. Roboto-Medium or Roboto-Black in styles.xml

蓝咒 提交于 2019-12-03 01:00:17
问题 Posts like this How to change fontFamily of TextView in Android suggests, that the variants of Roboto fonts you can specify in styles.xml in Android 4.2 boils down to the following: Regular Italic Bold Bold-italic Light Light-italic Thin Thin-italic Condensed regular Condensed italic Condensed bold Condensed bold-italic That leaves out the ability to style TextViews using eg. the Roboto-Medium or Roboto-Black fonts. But why would Google add system wide fonts that can not be used for styling

How do I specify eg. Roboto-Medium or Roboto-Black in styles.xml

我的梦境 提交于 2019-12-02 14:21:30
Posts like this How to change fontFamily of TextView in Android suggests, that the variants of Roboto fonts you can specify in styles.xml in Android 4.2 boils down to the following: Regular Italic Bold Bold-italic Light Light-italic Thin Thin-italic Condensed regular Condensed italic Condensed bold Condensed bold-italic That leaves out the ability to style TextViews using eg. the Roboto-Medium or Roboto-Black fonts. But why would Google add system wide fonts that can not be used for styling of your TextViews? Surely there must be some way of specifying all of the Roboto fonts from within

Access assets in Fragment

梦想与她 提交于 2019-12-02 07:30:27
问题 I have a Font in my assets folder and I called it in my fragment like this: Typeface custom_font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/myFont.otf"); But I got a lint warning saying that getAssets() may return null. I did some research and found this question/answer. I'm currently already getting the activities context. What I was thinking of doing is adding the following method in my Activity : public static Typeface getMyFont(Activity context){ return Typeface

Access assets in Fragment

一个人想着一个人 提交于 2019-12-02 05:15:58
I have a Font in my assets folder and I called it in my fragment like this: Typeface custom_font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/myFont.otf"); But I got a lint warning saying that getAssets() may return null. I did some research and found this question/answer. I'm currently already getting the activities context. What I was thinking of doing is adding the following method in my Activity : public static Typeface getMyFont(Activity context){ return Typeface.createFromAsset(context.getAssets(), "fonts/myFont.otf"); } and then calling it from my fragment like this:

Edittext Fonts Are Not Displaying

元气小坏坏 提交于 2019-12-01 18:56:02
I'm going through a weird problem. I have created CustomEdittext class for setting Typeface for whole application and it works successfully in nearly all cases. I am using circo.ttf The problem is that when I set android:inputType="textPassword" , text stops displaying after typing, maybe because the font doesn't have a password symbol or maybe there is some other problem. Below is an example of my issue : CustomEdittext.java public class CustomEdittext extends EditText { public CustomEdittext(Context context) { super(context); changeFonts(context); } public CustomEdittext(Context context,