Use item decorator

pull/153/head
M66B 6 years ago
parent 60bdea9435
commit 5d681e56aa

@ -34,6 +34,7 @@ import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -80,6 +81,10 @@ public class FragmentRules extends FragmentBase {
adapter = new AdapterRule(getContext(), getViewLifecycleOwner());
rvRule.setAdapter(adapter);
DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
itemDecorator.setDrawable(getContext().getDrawable(R.drawable.divider));
rvRule.addItemDecoration(itemDecorator);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

@ -2,15 +2,15 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp">
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/activatableItemBackground"
android:foreground="?attr/selectableItemBackground">
android:foreground="?attr/selectableItemBackground"
android:padding="6dp">
<TextView
android:id="@+id/tvName"

@ -9,13 +9,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/activatableItemBackground"
android:foreground="?attr/selectableItemBackground">
android:foreground="?attr/selectableItemBackground"
android:padding="6dp">
<TextView
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:ellipsize="end"
android:maxLines="1"
@ -42,20 +42,8 @@
android:id="@+id/ivStop"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:src="@drawable/baseline_stop_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/vSeparator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colorSeparator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivStop" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
Loading…
Cancel
Save