Ich lese über android data binding und möchte es in meiner Anwendung verwenden, , aber ich scheiterte auf XML-Layout-Bühne.TabHost Layout und DataBinding
Ich habe activity_main.xml
wie folgt aus:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/tab1"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</layout>
und tab1.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<EditText
...
ich anwenden möchten Daten zur letzten EditText
verbindlich, aber wenn ich einfügen
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<TabHost>
...
dies verursacht
activity_main.xml:9: AAPT: Error parsing XML: duplicate attribute
Die Frage ist, wie soll ich combind Datenbindung und TabHost
EditText
in eingeschlossenem Layout zu binden?
Here is repo with code from question
Warum haben Sie nicht alle Ihre Tags geschlossen? – Codebender
zeigen Sie uns volle xml – Salman500
@ Salman500 hier können Sie Xml aus Frage finden https://github.com/davilter/TabHostDataBinding/tree/master/app/src/main/res/layout – user1244932