From 5ad1ac9200f7fc0f2a46e9d70fbc7340b2c095af Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Wed, 18 Sep 2024 09:42:46 +0200 Subject: [PATCH] fix(android): fix ListView layout with header and footer only (#14117) * fix(android): fix ListView layout with header and footer only * remove log * Update android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java Co-authored-by: Chris Barber * rename variable --------- Co-authored-by: Chris Barber --- .../titanium/ui/widget/listview/ListViewHolder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java index 0a400cd4705..137b0661f9a 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java @@ -412,7 +412,13 @@ private void setHeaderFooter(TiViewProxy listViewProxy, ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone((ConstraintLayout) this.container); - constraintSet.connect(R.id.titanium_ui_listview_holder_content, ConstraintSet.BOTTOM, + + int constraintStartId = R.id.titanium_ui_listview_holder_header; + if (this.content.getChildCount() > 0) { + constraintStartId = R.id.titanium_ui_listview_holder_content; + } + + constraintSet.connect(constraintStartId, ConstraintSet.BOTTOM, R.id.titanium_ui_listview_holder_footer, ConstraintSet.TOP, 0); constraintSet.connect(R.id.titanium_ui_listview_holder_left_image, ConstraintSet.BOTTOM, R.id.titanium_ui_listview_holder_footer, ConstraintSet.TOP, 0);