[UI] scrollable gridview

This commit is contained in:
leca 2024-09-29 15:59:57 +03:00
parent 8747e44ae6
commit 743c74b2f2
3 changed files with 14 additions and 15 deletions

View File

@ -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<GridView>(R.id.contentGridLayout)?.addView(
getView()?.findViewById<GridLayout>(R.id.contentGridLayout)?.addView(
AbstractProductView(
requireActivity(),
requireContext(),
@ -51,6 +51,7 @@ class StorageFragment : Fragment() {
category = 1
)
)
// getView()?.findViewById<GridView>(R.id.contentGridLayout)?
}
}
}

View File

@ -1,15 +1,15 @@
<LinearLayout
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" android:layout_width="300dp"
android:layout_height="300dp">
xmlns:tools="http://schemas.android.com/tools" android:layout_width="200dp"
android:layout_height="200dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="300dp"
android:layout_height="300dp" android:id="@+id/productLayout">
android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/productLayout" android:outlineProvider="bounds">
<ImageView
android:layout_width="match_parent"
android:layout_height="179dp" app:srcCompat="@android:drawable/ic_btn_speak_now"
android:layout_height="100dp" app:srcCompat="@android:drawable/ic_btn_speak_now"
android:id="@+id/productPicture"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

View File

@ -4,17 +4,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".StorageFragment">
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/contentGridLayout" app:columnCount="2"
app:rowCount="100">
</androidx.gridlayout.widget.GridLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:id="@+id/contentLayout"/>
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/contentGridLayout" app:columnCount="2"
app:rowCount="100" android:nestedScrollingEnabled="true">
</androidx.gridlayout.widget.GridLayout>
</ScrollView>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"