Reputation: 12678
I have a top section for the app which is mainly logo and stuff, and roughly the bottom half is supposed to be buttons.. In the outer container, i have a layout for the logo, and imageView to create a seperator line between the top and bottom and the bottom layout..
The issue is bottom layout has 2 linearlayouts (one of which is hidden initially) first one is just a spinner and the second one is 2 buttons..
I have achieved the "roughly 1/3 of space) by using layout_weights in the top and bottom linear layout (2 and 1 respectively) but when I hide the spinner and show the 2 buttons in the bottom layout in the code, the seperator line is pushed up.. I want it to stay in the same place (like be where it would be after the 2 buttons show up from the get-go so that it doesn't have to move)
I could probably just add some margin to the original one to match it but i feel like that will cause issues in the future on different devices.
How can I accomplish this feat?
Upvotes: 0
Views: 184
Reputation: 9908
I think you might be neglecting to set android:layout_height="0dp"
on the LinearLayouts that you set android:layout_weight="1"
on. If you do this it should fill the space like you want, and you can do layoutView.setVisibility(View.GONE)
and layoutView.setVisibility(View.VISIBLE)
to toggle the views.
Upvotes: 1