0
0

More than 5 years have passed since last update.

【めも】ios, Androidでテキストに下線表示

Posted at

最近仕事でAndroidもいじるようになってADT Bundleにいらだちながらもがんばる毎日。

レイアウトファイルがiOSと異なり、xmlで記述する。
xmlファイル内には様々なレイアウトがあり、htmlよろしくmarginやpaddingなどの指定が大事、
またAのレイアウトの下に表示するなどの指定もあり、絶対位置を指定するよりは相対位置を指定することが
多いあたり画面サイズの多様なAndroidにあわせたものだなーとしみじみ感じた。

今回はそんなかでもiosでいう、UILabelに相当するTextViewの中身について調べた。

string.xml
 <string name="hello_styled"><u>Hello World, TextViewHtmlTest!</u></string>
 <string name="hello_escaped_styled">& lt;u>Hello World, TextViewHtmlTest!& lt;/u></string> 
 <string name="app_name">TextViewHtmlTest</string>
layout.xml
<TextView 
        android:id="@+id/txt1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text=""
        />
    <TextView 
        android:id="@+id/txt2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text=""
        />
    <TextView 
        android:id="@+id/txt3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text=""
        />

string側での指定になるので、グラフィックツールのプロパティには無い

iosでは以下のようにプロパティにあるので下線つきのUILabelが簡単につけれる
iOSのUILabelにアンダーラインを引く方法

柔軟さで言えばAndroid, 手軽さでいえばiosなイメージ
こんな記事も出てるので見てみると面白いと思います

Android vs. iOS, アプリはどっちから先に作る/売り出すべきか

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0