Some Font Characters Doesn't Seem Properly On Android? - android

For Android and IOS platforms same font used. It's looking good on IOS, but android doesn't show some characters like "Ş", "Ğ" properly.The below screenshot from android.
Seems it's not font specific problem beacuse on IOS working well.
<TextView
android:id="#+id/txt_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="#font/avenirltstd_book"
android:text="Şikayet Grafiği"
android:textColor="#color/white"
android:textSize="#dimen/dp18" />
Is there any special way to show these characters with same font? Or the solution is to stop dealing with this and use different font ?

check this post for setting special characters in xml file and this if you want to set using java language

Related

fontFeatureSettings=smcp doesn't work in Android

I need to show SmallCaps text in TextView. I am trying to use code below:
<TextView
android:id="#+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFeatureSettings="smcp"
android:textColor="#color/black"
android:textSize="16sp"
android:text="TEXT" />
But it just shows me normal text, without SmallCaps effect. I also try to set it programmatically (text1.fontFeatureSettings = "smcp") but also without success.
How to make SmallCaps text in Android? Why fontFeatureSettings doesn't work?
In order for this feature to work you have to have a font that actually has Small Caps characters - thus to make it work pass the font with Small Caps via app:fontFamily(android:fontFamily) for example Aller Display, and then use android:fontFeatureSettings="smcp" to make it Small Caps.
Hope it helps
Edit
as #Cliabhach pointed in comments, in code it will look something like
text1.typeface = resources.getFont(R.font.Aller_Display)
text1.fontFeatureSettings = "smcp"
Edit2
Keep in mind
For those who do not know - Small Caps will only work on lowercase characters
As you are using TextView so I guess you set value to it at runtime like says you have some String object which will get set to the TextView like:
textView.setText(someStringObj);
So you can easily set it as in lower case on it by adding:
textView.setText(someStringObj.toLowerCase());

Downloadable font not displaying for Switch TextView

I'm using downloadable fonts for an app, and it's working just fine, however when I've tried to apply the font to the TextView of a Switch, my device won't display it and resorts to the default font - it displays the font correctly for TextViews in the same activity outside of the Switch component.
Strangely, the Android Studio layout design window shows the correct font, but when running on device, it doesn't seem to work correctly.
<Switch
android:id="#+id/switch1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="#font/baloo_bhai"
android:text="This is a switch"
android:theme="#style/AppTheme.Switch"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/editText2" />
This is the display in Android Studio:
This is from my device:
It transpires this is a known issue Google Issue #63250768
A fix was located in another StackOverflow question however downloadable fonts will not work with this method - until a resolution, font files must be embedded into the application, as .XML fonts will not work.
Great job, Google!

Android O Text Justification Hebrew

I know there has been A LOT of talk here regarding justifying text in Android. But Android O just came out and a new feature came out with it, Text Justification. They say use the final JUSTIFICATION_MODE_INTER_WORD included with the TextView class. Along with setJustificationMode(). it does work when I use it with the English language, but it fails to work when I use it with the Hebrew language. I have it set up to:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:justificationMode="inter_word"
android:text="#string/ahahvaRabba"
android:textDirection="rtl"
/>
I also tried to put android:gravity="right" but that didnt work either.
I cant imagine that google didn't think of using it with other languages.

How to format Text in a view from the Server. Xamarin Android

I'm working on a Xamarin Android App using axml views. One of the views requires that the textview on one view be configurable from the server. For example setting the font, being able to use bullet points and so on. Any recommendations for packages for ideas on how to accomplish this? Below is the axml :
<TextView
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="fill_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:textColor="#android:color/black"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:id="#+id/ParagraphTextView" />
Just looking for idea's on how to make this possible.
Well this depends what you mean by configurable.
In code you can for instance call:
Typeface type = Typeface.CreateFromAsset(GetAssets(),"fonts/Roboto.ttf");
paragraphTextView.SetTypeface(type);
Assuming your fonts are in your assets folder. If you don't have them you'll have to manage downloading them and storing them and getting the font asset from wherever you store it.
For bullet points you could maybe try HTML via:
var myText = "• An item with a bullet before it<br/>"
paragraphTextView.SetText(Html.FromHtml(myText));
For more bullet ideas see:
How to add bulleted list to android application?

Turkish characters don't appear in Android

I have this xml :
<TextView
android:id="#+id/tv_mytv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
And I have this Java :
TextView mytv;
mytv= (TextView) findViewById(R.id.tv_mytv);
mytv.setText(Html.fromHtml("<p>ğüşçı</p>"));
When I run the emulator, All I get is question marks in diamond shaped icons. How can I make my app display Turkish characters? Thanks.
Check that the charset is set to UTF-8/16 or ISO-8859-9 (Turkish charset). If that doesn't solve the problem, it could be the font itself. Try running the app on a real device to see if it works.
EDIT -
You can also try unicode charecters. For example - http://unicode-table.com/

Categories

Resources