vertical scrolling for cards

This commit is contained in:
akaessens 2020-09-19 12:19:25 +02:00
parent fecf4ae4e8
commit 3c73ea2d77
3 changed files with 53 additions and 10 deletions

View File

@ -93,11 +93,11 @@ public class MainActivity extends AppCompatActivity {
events = createEventList();
adapter = new EventAdapter(events);
recycler_view.setAdapter(adapter);
linear_layout_manager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
linear_layout_manager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recycler_view.setLayoutManager(linear_layout_manager);
recycler_view.setHasFixedSize(true);
SnapHelper snap_helper = new LinearSnapHelper();
snap_helper.attachToRecyclerView(recycler_view);
//recycler_view.setHasFixedSize(true);
//SnapHelper snap_helper = new LinearSnapHelper();
//snap_helper.attachToRecyclerView(recycler_view);
/*

View File

@ -8,7 +8,7 @@
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
<!-- <com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -22,6 +22,45 @@
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="NoFb Event Scraper" />
</com.google.android.material.appbar.AppBarLayout>-->
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="180dp"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/layout_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="center"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="NoFb Event Scraper" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
@ -32,10 +71,9 @@
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end"
app:icon="@drawable/ic_content_paste"
android:text="@android:string/paste"
android:tooltipText="@string/tooltip_paste"
tools:ignore="UnusedAttribute" />
<include layout="@layout/content_main" />
<com.google.android.material.bottomappbar.BottomAppBar

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView 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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="64dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
@ -47,3 +51,4 @@
android:layout_height="match_parent"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>