私は約android data bindingを読んで、私のアプリケーションでは を使っていますが、xmlレイアウトステージで失敗しました。TabHostレイアウトとデータバインディング
<?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>
とtab1.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<EditText
...
は、私が最後EditText
へのデータバインディングを適用したいが、私は
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<TabHost>
...
を挿入する場合、私はこのようなactivity_main.xml
を持って
これにより、
activity_main.xml:9: AAPT: Error parsing XML: duplicate attribute
質問は、データバインディングをどのように組み合わせてTabHost
をEditText
にバインドするのがいいですか?
Here is repo with code from question
なぜあなたはタグを一切閉じていませんか? – Codebender
私たちにフルxmlを表示 – Salman500
@ Salman500ここから質問からxmlを見つけることができますhttps://github.com/davemilter/TabHostDataBinding/tree/master/app/src/main/res/layout – user1244932