Casebash
Casebash

Reputation: 118972

gravity="fill_vertical" vs. layout_height="fill_parent" in Android

Why does gravity offer a "fill_vertical" option? How is this any different from setting layout_height "fill_parent"? What if I choose a fixed layout_height and "fill_vertical" for gravity? Won't this contradict?

Upvotes: 1

Views: 3296

Answers (1)

Dan Lew
Dan Lew

Reputation: 87430

I believe that using gravity="fill_vertical" indicates that the View should take up as much space as possible vertically while still respecting other Views' height constraints. If you use layout_height="fill_parent", you're telling the View to take up the entire parent's height; this may result in a single View pushing other Views off the viewport.

Upvotes: 1

Related Questions