0

As an Android Developer, I am developing a Kotlin app in which on a certain screen I have to make a horizontal carousel of items whose specifications are as follows:

  • If the nested text in TextView1 is long enough to span 3 lines, the whitespace below TextView2 will be a fixed 12dp.
  • If the text nested in TextView1 is long enough to occupy more than 3 lines, the situation will be the same as for the previous point but with the ellipsize="end" property for TextView1.
  • If the text nested in TextView1 only occupies 1 line, the space between TextView2 and TextView3 will grow until it occupies the space not used by TextView1 as in the previous points.

This image is what it should look like: https://i.stack.imgur.com/ppCL5.png

Notes:

  • All items in the carousel must have the same height.
  • We are not allowed to set a minHeight or height for the container of the view commented.
  • The screen has to be prepared for fontScaling and accessibility.
  • I can't use Jetpack Compose due to QA team automation test issues, so this option is totally ruled out.
  • I can't upload images because I don't have enough reputation on StackOverflow.

Thanks in advance.

  • Just use a simple Constraints Layout with Bottom to top hierarchy and set root layout height to 0 dp with bottom-bottom and top-top constraints to parent.! – Kartik Agarwal Sep 15 '22 at 13:57
  • This StackOverflow answer saved my day: https://stackoverflow.com/a/64322065/10050704 –  Sep 19 '22 at 06:40

0 Answers0