最近仕事で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なイメージ
こんな記事も出てるので見てみると面白いと思います