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

A Filipino programmer with a variety of interests such as baking, singing, making up silly song/rap lyrics, K-pop, drawing, creating unique dessert flavors, obsessing about finding out how some things works, board games, anime, video games, and forgetting things that usually go in her long list of interests. Running small-time online dessert shops Cookies PH and Catzie's Cakery.

Leave a Reply

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