Expand ScrollView vertically if height is smaller than screen // Android Dev Diary

I have the following XML layout code in an Android app that I’ve been tinkering with:

I wrapped my GridLayout in a ScrollView because on the landscape orientation of the Android app’s screen, my grid contents are cut from the view because they’re too tall, and there’s no way to see them without a scrollbar, which the ScrollView provides.

That gave birth to another problem though. The landscape view looks fine, but the vertical view became too short!

After a few clicks at Google search results I found something that helped:

I added the above attribute to my ScrollView, and voila! A GridLayout that scrolls vertically on landscape view, and fits the height of the Android device screen perfectly on portrait view~

Related Posts:

Posts that may be related to "Expand ScrollView vertically if height is smaller than screen // Android Dev Diary":

Catzie

An odd human being who happens to have a variety of ever-changing interests, but right now they are programming, making up silly song/rap lyrics, K-pop, drawing, creating unique dessert/drink flavors, obsessing about finding out how some things works, automation, anime, video games... Ran online dessert shops Cookies PH and Catzie's Cakery in her past life.

Leave a Reply

Your email address will not be published. Required fields are marked *