1
I would like Layout to have the size of the screen horizontal. But when the screen turned, it would still be the same size. I’ve made a little sketch of how I intend it to look:
The current xml is only :
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="16dp"></LinearLayout>
Edited
I ended up using even the code in the create da acivity:
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int minimo=Math.min(dm.widthPixels,dm.heightPixels);
View layoutAlto = findViewById(R.id.login_layoutalto);
layoutAlto.getLayoutParams().width = minimo;
Thanks for the help
What do you mean? The image doesn’t appear here for me.
– user28595
http://i.stack.Imgur.com/UPS1Z.png
– Rodrigo Santiago
I still can’t see :/ Let me see if I understand: you want the layout to be the same size, regardless of the orientation of the canvas (landscape or portrait)?
– user28595
The width at least. In portrait mode it fills the width, in landscape mode it does not change the width.
– Rodrigo Santiago
Do you want it to look like it is in the sketch or do you want it to look like a landscape? Post xml.
– ramaral
@Rodrigosantiago as is your layout file currently?
– Arubu
I got the same question @ramaral
– Arubu
I want it to look like in the sketch! I didn’t post the xml pq and only a layout with fill_parent.
– Rodrigo Santiago
The correct is that the width of the layout adapts according to the orientation of the device. This width can be different according to the various models of devices we have on the market. If you really need the layout according to the sketch, you will have to take the dimension of shorter length and configure it in the runtime layout_width. Let your need be known, maybe we can help you.
– Arubu
Rodrigo, if you managed to solve the problem, post the solution as an answer just below and mark as "accepted".
– user28595