Log in



サブクラスをxmlファイルで使用する時の記述の仕方

Tuesday, January 8th, 2013 by

レイアウト等のサブクラスをxmlファイルで使用する時は、通常のクラス名に加えてパッケージ名を記述しないと認識されません。
今回はLinearLayoutを継承したMyLinearLayoutクラスを使用しています。

<com.example.textinputspeech.MyLinearLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
       android:id="@+id/linear"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:orientation="horizontal" >
</com.example.textinputspeech.MyLinearLayout>

パッケージ名はMainActivity等のjavaファイルの一行目に記述されています。

Comments

comments

Leave a Reply