1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-29 19:20:36 +02:00

Add divider between items and header

This commit is contained in:
Erik Johansson
2018-06-19 20:39:31 +02:00
parent b0df4fd3aa
commit b94e3d8a78
2 changed files with 11 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.SpannableStringBuilder;
@@ -40,7 +41,6 @@ import com.health.openscale.gui.activities.DataEntryActivity;
import com.health.openscale.gui.views.MeasurementView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
@@ -51,7 +51,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
private RecyclerView recyclerView;
private MeasurementsAdapter adapter;
private RecyclerView.LayoutManager layoutManager;
private LinearLayoutManager layoutManager;
private List<MeasurementView> measurementViews;
@@ -71,6 +71,9 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new DividerItemDecoration(
recyclerView.getContext(), layoutManager.getOrientation()));
adapter = new MeasurementsAdapter();
recyclerView.setAdapter(adapter);

View File

@@ -1,5 +1,4 @@
<LinearLayout 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="match_parent"
android:orientation="vertical">
@@ -10,8 +9,12 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
</LinearLayout>
android:paddingTop="5dp" />
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="?android:attr/listDivider" />
<android.support.v7.widget.RecyclerView
android:id="@+id/tableDataView"