From c4bfc119df13c64626067d88ad03b841807827e5 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Fri, 17 Oct 2025 19:28:52 +0200 Subject: [PATCH] Improve the alignment of `titleTextView` and `audioTrackTextView` This fulfills the following: * both should never push content outside of the view * there should be no wasted space * `audioTrackTextView` is always aligned to the right * both should grow equally but also respect their respective contents size first Caveats: * Currently the layout weight is distributed using "NestedWeights" which require a widget to be measured twice. According to Android Studio this might cause an exponential performane impact, however there is currently just a single nested component so the effect should be not noticeable --- app/src/main/res/layout/player.xml | 117 ++++++++++++++++------------- 1 file changed, 66 insertions(+), 51 deletions(-) diff --git a/app/src/main/res/layout/player.xml b/app/src/main/res/layout/player.xml index 321d07d3c..4e69bd9fa 100644 --- a/app/src/main/res/layout/player.xml +++ b/app/src/main/res/layout/player.xml @@ -119,64 +119,79 @@ tools:ignore="RtlHardcoded" /> + android:orientation="horizontal"> - + android:layout_marginTop="6dp" + android:layout_marginEnd="8dp" + android:layout_weight="1" + android:gravity="top" + android:orientation="vertical" + tools:ignore="NestedWeights,RtlHardcoded"> + + + + + + + + + + + - - -