Я смотрю на этот плагин , и я хочу изменить демонстрацию, чтобы использовать макеты вместо того, чтобы писать все в коде.
// 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
// второй макет.
<?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>