Şu an yapıyorum bir uygulama için özel bir yazı tipi kullanıyorum. Çoğu telefonun özel yazı tipi düzgün çalışıyor.Özel yazı tipi her yerde çalışmıyor Android
:Ancak bazı telefonun yazı üzerine
Özellikle siyah alanda hariç her yerde kullanılabilirsonuç istediğim şu anda kesinlikle clueless, tüm textViews baskın olmadığından
sonuç alıyorum:
Kodu: XML
public final class FontsOverride {
public static void setDefaultFont(Context context,
String staticTypefaceFieldName, String fontAssetName) {
final Typeface regular = Typeface.createFromAsset(context.getAssets(), fontAssetName);
replaceFont(staticTypefaceFieldName, regular);
}
protected static void replaceFont(String staticTypefaceFieldName,
final Typeface newTypeface) {
try {
final Field staticField = Typeface.class.getDeclaredField(staticTypefaceFieldName);
staticField.setAccessible(true);
staticField.set(null, newTypeface);
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageViewNewestArticleImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@android:color/black"
android:src="@drawable/emptychatuser"/>
<TextView
android:id="@+id/textViewNewestArticleTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sampleTitle"
android:layout_gravity="bottom"
android:textAllCaps="true"
android:textColor="@android:color/white"
android:textSize="25sp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="20dp"
android:padding="5dp" />
</FrameLayout>
hm xml'nizdeki başka herhangi bir yazı tipine yönelik başka özelleştirmeler var mı? –
Sadece normal bir metin görünümünde, bu ve diğer metin görünümü arasındaki tek fark arka plan renginin farklı olmasıdır. –
Rengi değiştirmek için neden yansıma kullanıyorsunuz? –