Can I underline text in an Android layout?

It can be achieved if you are using a string resource xml file, which supports HTML tags like <b></b>, <i></i> and <u></u>. <resources> <string name=”your_string_here”><![CDATA[This is an <u>underline</u>.]]></string> </resources> If you want to underline something from code use: TextView textView = (TextView) view.findViewById(R.id.textview); SpannableString content = new SpannableString(“Content”); content.setSpan(new UnderlineSpan(), 0, content.length(), 0); textView.setText(content);

Set a default font for whole iOS app?

It seems to be possible in iOS 5 using the UIAppearance proxy. [[UILabel appearance] setFont:[UIFont fontWithName:@”YourFontName” size:17.0]]; That will set the font to be whatever your custom font is for all UILabels in your app. You’ll need to repeat it for each control (UIButton, UILabel, etc.). Remember you’ll need to put the UIAppFonts value in … Read more

Using a custom typeface in Android

Yes It is possible. You have to create a custom view which extends text view. In attrs.xml in values folder: <resources> <declare-styleable name=”MyTextView”> <attr name=”first_name” format=”string”/> <attr name=”last_name” format=”string”/> <attr name=”ttf_name” format=”string”/> </declare-styleable> </resources> In main.xml: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:lht=”http://schemas.android.com/apk/res/com.lht” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” > <TextView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:text=”Hello”/> <com.lht.ui.MyTextView android:id=”@+id/MyTextView” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:text=”Hello friends” lht:ttf_name=”ITCBLKAD.TTF” /> … Read more

How to write WinForms code that auto-scales to system font and dpi settings?

Controls which do not support scaling properly: Label with AutoSize = False and Font inherited. Explicitly set Font on the control so it appears in bold in the Properties window. ListView column widths don’t scale. Override the form’s ScaleControl to do it instead. See this answer SplitContainer‘s Panel1MinSize, Panel2MinSize and SplitterDistance properties TextBox with MultiLine … Read more

How to Set a Custom Font in the ActionBar Title?

You can do this using a custom TypefaceSpan class. It’s superior to the customView approach indicated above because it doesn’t break when using other Action Bar elements like expanding action views. The use of such a class would look something like this: SpannableString s = new SpannableString(“My Title”); s.setSpan(new TypefaceSpan(this, “MyTypeface.otf”), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // … Read more

How do I make an attributed string using Swift?

This answer has been updated for Swift 4.2. Quick Reference The general form for making and setting an attributed string is like this. You can find other common options below. // create attributed string let myString = “Swift Attributed String” let myAttribute = [ NSAttributedString.Key.foregroundColor: UIColor.blue ] let myAttrString = NSAttributedString(string: myString, attributes: myAttribute) // … Read more

How to change the font on the TextView?

First, the default is not Arial. The default is Droid Sans. Second, to change to a different built-in font, use android:typeface in layout XML or setTypeface() in Java. Third, there is no Helvetica font in Android. The built-in choices are Droid Sans (sans), Droid Sans Mono (monospace), and Droid Serif (serif). While you can bundle … Read more