2024/4/2

跟教程写一个todoapplication

fragment_list样式代码

<?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"
xmlns:tools="http://schemas.android.com/tools">

<data>
<variable
name="mSharedViewModel"
type="com.example.to_do_application.fragments.SharedViewModel">

</variable>
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listLayout"
tools:context=".fragments.list.ListFragment">


<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:paddingTop="8dp"
android:clipToPadding="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
android:backgroundTint="#673AB7"
android:clickable="true"
android:focusable="true"
android:navigateToAddFragment="@{true}"
android:src="@drawable/ic_add"
android:tint="@color/white"
app:backgroundTint="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

<ImageView
android:id="@+id/no_data_imageView"
android:layout_width="238dp"
android:layout_height="195dp"
android:src="@drawable/ic_baseline_no_sim_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.49"
android:visibility="invisible"
android:emptyDatabase="@{mSharedViewModel.emptyDatabase}"
app:layout_constraintStart_toStartOf="@+id/recyclerView"
app:layout_constraintTop_toTopOf="@+id/recyclerView"
app:layout_constraintVertical_bias="0.38" />

<TextView
android:id="@+id/no_data_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" no_data"
android:textSize="16sp"
android:alpha="0.5"
android:visibility="invisible"
android:emptyDatabase="@{mSharedViewModel.emptyDatabase}"
app:layout_constraintEnd_toEndOf="@+id/recyclerView"
app:layout_constraintStart_toStartOf="@+id/recyclerView"
app:layout_constraintTop_toBottomOf="@+id/no_data_imageView" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
posted @ 2024-04-02 19:36  Hbro  阅读(23)  评论(0)    收藏  举报