How to avoid cutting off views in a non-scrollable layout in Android devices below certain height

47 Views Asked by At

I have a constraint layout that cannot scroll, all the views have to be visible all the time. The problem that I have is that with devices of height 1920 or less, the UI gets really crowded and some text views start overlapping, bottom gets cut off a little.

Layout structure is

<ConstraintLayout>
  <LinearLayout />
  <FrameLayout /> <-- this has an imageview of fixed height of 192dp
  <some views..>
  <last view> <-- has app:layout_constraintBottom_toBottomOf="parent" constraint
</ConstraintLayout>

How do I say height 1920 or below use a different layout? I tried some qualifiers such as sw320dp, layout-h1920dp (not a good choice) on Nexus 5 but it doesn't pickup the layout from those directories. How do I handle Nexus 5 in this case?

I don't think measuring the height and doing a dynamic layout is an attractive option.

1

There are 1 best solutions below

4
Gabe Sechan On

You can't do size<y use a different layout, but you can do size >x use a different layout. So do that. Put the small sized layout in your layouts directory, and your big layout in the layout-h1920dp.

BTW, 1920dp is huge. That's 12 inches in height alone (160dp=1 inch)- basically you'd be looking at a monitor. Even the biggest tablets only have 12 inch diagonals, and that's a tiny number- most are 7 or 10 inch. I doubt there's any model on the market that big. So 1920 dp is not the size you're going to want.