It seems the Flexbox
solution worked for you, however there is another approach that can provide a different avenue for this problem. In case you are not aware, you can actually define different XML layout files with the same name - 1 for portrait mode, and another for landscape mode.
When creating a new layout file, if you right click on the layout
directory and select New > Layout resource file you can configure the orientation here. In the Available qualifiers section, scroll down to Orientation and add it to the file. At this point, you will be able to choose the orientation for this layout and, if you name the file the same name as the opposite orientation, your app will automatically inflate the view that is appropriate for the device's current orientation. Android Studio will also understand the different layout orientations you have chosen while in the editor, and the screen you see in the Design
tab will be adjusted accordingly i.e. the landscape layout file will have more room vertically to build the UI with.
Note that this adds a level of complexity to the application itself in the sense that the activity lifecycles will need to be accounted for since the views are now being destroyed and re-drawn by the OS in response to when the user switches the orientation of their device.
Hope this helps either in this situation or in some other situation where you want to accomplish different layouts based on device orientation!