AndroidStudio无法导入ActivityMainBinding

时间:2018-12-19 15:56:37

标签: android android-layout android-databinding

在Android Studion上创建简单的Activity之后,我想使用MVVM,以解决我在应用文件夹中binding上激活gradle的问题,然后添加{ {1}}到xml例如:

<layout></layout>

然后我删除<?xml version="1.0" encoding="utf-8"?> <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:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/grey_5" android:orientation="vertical"> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/spacing_smlarge" android:clickable="true" android:tint="@color/grey_90" app:backgroundTint="@android:color/white" app:fabSize="normal" app:rippleColor="@color/grey_40" app:srcCompat="@drawable/ic_thumb_up" /> </android.support.design.widget.CoordinatorLayout> </layout> 并创建以下行:

setContentView

在我的此类课程中,在ActivityMainBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_main); } rebuildclean之后,android studio再次不知道rebuild是什么导入。

ActivityMainBinding文件内容:

Gradle

0 个答案:

没有答案