From 743c74b2f2d7d75025c76604306488946e371a56 Mon Sep 17 00:00:00 2001 From: leca Date: Sun, 29 Sep 2024 15:59:57 +0300 Subject: [PATCH] [UI] scrollable gridview --- .../barcodescannerforemployees/StorageFragment.kt | 5 +++-- app/src/main/res/layout/abstract_product_view.xml | 10 +++++----- app/src/main/res/layout/fragment_storage.xml | 14 ++++++-------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/StorageFragment.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/StorageFragment.kt index c2cad93..3eb9e39 100644 --- a/app/src/main/java/org/foxarmy/barcodescannerforemployees/StorageFragment.kt +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/StorageFragment.kt @@ -5,8 +5,8 @@ import android.provider.BaseColumns import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.GridView import androidx.fragment.app.Fragment +import androidx.gridlayout.widget.GridLayout /** * A simple [Fragment] subclass. @@ -41,7 +41,7 @@ class StorageFragment : Fragment() { val netWeight = getDouble(getColumnIndexOrThrow(ProductContract.ProductEntry.PRODUCT_NET_WEIGHT)) val pictureFilename = getString(getColumnIndexOrThrow(ProductContract.ProductEntry.IMAGE_FILENAME)) - getView()?.findViewById(R.id.contentGridLayout)?.addView( + getView()?.findViewById(R.id.contentGridLayout)?.addView( AbstractProductView( requireActivity(), requireContext(), @@ -51,6 +51,7 @@ class StorageFragment : Fragment() { category = 1 ) ) +// getView()?.findViewById(R.id.contentGridLayout)? } } } diff --git a/app/src/main/res/layout/abstract_product_view.xml b/app/src/main/res/layout/abstract_product_view.xml index 04b20c7..9b63247 100644 --- a/app/src/main/res/layout/abstract_product_view.xml +++ b/app/src/main/res/layout/abstract_product_view.xml @@ -1,15 +1,15 @@ + xmlns:tools="http://schemas.android.com/tools" android:layout_width="200dp" + android:layout_height="200dp"> + android:layout_width="match_parent" + android:layout_height="match_parent" android:id="@+id/productLayout" android:outlineProvider="bounds"> diff --git a/app/src/main/res/layout/fragment_storage.xml b/app/src/main/res/layout/fragment_storage.xml index b0fa424..578af38 100644 --- a/app/src/main/res/layout/fragment_storage.xml +++ b/app/src/main/res/layout/fragment_storage.xml @@ -4,17 +4,15 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".StorageFragment"> - - - - + + +