changeset 2682:856d3c8b559f

Android: Fix an exception when displaying a notebook with a placeholder. Before a page is packed, I put in a placeholder... the placeholder needs to be MATCH_PARENT to be in a ViewPager2.. create the placeholder MATCH_PARENT.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 25 Oct 2021 17:07:01 +0000
parents c1482518b643
children e7885fd45f7b
files android/DWindows.kt
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/android/DWindows.kt	Mon Oct 25 11:29:34 2021 +0000
+++ b/android/DWindows.kt	Mon Oct 25 17:07:01 2021 +0000
@@ -2172,12 +2172,17 @@
                 } while (adapter.currentPageID == 0L || adapter.pageList.contains(adapter.currentPageID))
                 pageID = adapter.currentPageID
                 // Temporarily add a black tab with an empty layout/box
+                val placeholder = LinearLayout(this)
+                placeholder.layoutParams = LinearLayout.LayoutParams(
+                    LinearLayout.LayoutParams.MATCH_PARENT,
+                    LinearLayout.LayoutParams.MATCH_PARENT
+                )
                 if (front != 0) {
-                    adapter.viewList.add(0, LinearLayout(this))
+                    adapter.viewList.add(0, placeholder)
                     adapter.pageList.add(0, pageID)
                     tabs.addTab(tab, 0)
                 } else {
-                    adapter.viewList.add(LinearLayout(this))
+                    adapter.viewList.add(placeholder)
                     adapter.pageList.add(pageID)
                     tabs.addTab(tab)
                 }