textstyleとtypefaceを変更する
フォントの影の設定をする
今回はフォントの幅を変更したいと思います
フォントの横幅を変更する
フォントの幅を変更するには
textScaleX テキストの横方向の拡大率
を使用します
これをそれぞれ1、1.5、2、5と設定した例を示します
main.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/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 abc あいう 指定なし" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 abc あいう 1.0" android:textScaleX="1"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 abc あいう 1.5" android:textScaleX="1.5"/>
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 abc あいう 2" android:textScaleX="2"/>
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 abc あいう 5" android:textScaleX="5"/>
</LinearLayout>
結果は次のようになりますフォントの幅が変更されています
5はかなり幅広になってますねww
スポンサードリンク
【ウィジェット トーストの最新記事】

