在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);
}
和rebuild
和clean
之后,android studio再次不知道rebuild
是什么导入。
ActivityMainBinding
文件内容:
Gradle