【发布时间】:2016-02-02 03:01:39
【问题描述】:
test.xml:
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/include_content"
layout="@layout/content" />
</FrameLayout>
</layout>
内容.xml:
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test button"/>
</FrameLayout>
</layout>
Java 代码:
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
TestBinding binding=DataBindingUtil.setContentView(this, R.layout.test);
Button button = binding.includeContent.button;
}
当我运行应用程序时,Android Studio 构建错误“找不到符号变量 includeContent”
我错过了什么?
【问题讨论】:
标签: android