2011-08-04 1 views
0

私はこの pluginを見ていて、コード内にすべてを書き込むのではなく、レイアウトを使用するようにデモを変更することを望んでいました。レイアウトで動作するプラグインを実装するにはどうすればよいですか?

// note that you can also define your own views directly in a resource XML, too by using: 
    // <de.marcreichelt.android.RealViewSwitcher 
    //  android:layout_width="fill_parent" 
    //  android:layout_height="fill_parent" 
    //  android:id="@+id/real_view_switcher"> 
    //   <!-- your views here --> 
    // </de.marcreichelt.android.RealViewSwitcher> 

これは可能ですが、動作させることはできません。私は2つのレイアウトを作った。私はこの

<?xml version="1.0" encoding="utf-8"?> 
<de.marcreichelt.android.RealViewSwitcher 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:id="@+id/real_view_switcher"> 

<include android:id="@+id/myid1" layout="@layout/second" /> 

</de.marcreichelt.android.RealViewSwitcher> 

を持っている私のメインのレイアウトでは、私は

Description Resource Path Location Type 
error: Error parsing XML: unbound prefix main.xml /RealViewSwitcher/res/layout line 2 Android AAPT Problem 

かかわらず、このエラーを取得するだから私は、私はそれを名前空間か何かを与える必要があると思うが、私は何を使用するかわかりません。

私はちょうど私が知っている唯一の

xmlns:android="http://schemas.android.com/apk/res/android 

//第2のレイアウトを試してみました。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout android:id="@+id/relativeLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     xmlns:android="http://schemas.android.com/apk/res/android"> 
    <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="1" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_marginLeft="82dp" android:layout_marginTop="57dp"></TextView> 

</RelativeLayout> 

答えて

0

カスタムタグに

xmlns:android="http://schemas.android.com/apk/res/android
を使用してください。それは動作するはずです。

関連する問題