2016-09-12 7 views
4

私は非常に単純なレイアウトで、データバインディングの使用に切り替える必要がありました。今、私は私のcontroller_main.xmlに次のエラーを取得しています:データバインディングにはレイアウトファイルが含まれている必要があります

Error:Execution failed for task ':app:dataBindingProcessLayoutsDebug_pro'. 

**** /データバインディングエラー****のMSG:[44 68 44 68 25]をレイアウト ファイルを含める必要があります..エラーを結合。\アプリ\ SRC \メイン\ RES \レイアウト\ controller_main.xml **** \データ****

任意のアイデア?エラーは、タグ内のリソースandroid:layoutのIDが見つからないことを示しています(これは私の解釈です)が、それは当てはまりません。 includeタグをコメントアウトすると、エラーが削除されます。

誰にもこの問題がありますか?

controller_main.xml

<layout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" > 

    <android.support.design.widget.CoordinatorLayout 
     android:id="@+id/coordinatorLayout" 
     android:fitsSystemWindows="true" 
     android:background="?attr/main_background_color" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <RelativeLayout 
      android:id="@+id/rlContent" 
      android:fitsSystemWindows="true" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

     </RelativeLayout> 

     <include 
      android:layout_width="fill_parent" 
      android:layout_height="@dimen/tool_bar_top_padding" 
      android:id="@+id/stub_view_main_header_fixed" 
      android:layout="@layout/view_main_header_fixed" 
      app:elevation="0dp"/> 

     <android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> 

     </android.support.design.widget.AppBarLayout> 

    </android.support.design.widget.CoordinatorLayout> 

</layout> 

あなたはlayout代わりのandroid:layoutを使用する必要があります

<?xml version="1.0" encoding="utf-8"?> 
<View 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/vStatusbarBackground" 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/tool_bar_top_padding" /> 
+0

'INCLUDで「ID eのタグがありません "、これは不明な点は何ですか? – pskink

+0

インクルードが表示されますか? idを定義しています。そして、私はどこから '' includeタグのIDが見つからないのかわかりません。 ''から...レイアウトが欠けていると言います。しかしレイアウトも同様に定義されています。問題はすでに解決されています... – prom85

答えて

7

view_main_header_fixed.xml:

<include 
     android:layout_width="fill_parent" 
     android:layout_height="@dimen/tool_bar_top_padding" 
     android:id="@+id/stub_view_main_header_fixed" 
     layout="@layout/view_main_header_fixed" 
     app:elevation="0dp"/> 
+0

これは既に見つかっています;-)ありがとうございます。 'ViewStubs'を使用することから複数のレイアウトに変更することから来たものが含まれています... – prom85

関連する問題