Landscape mode does not work

Asked

Viewed 83 times

0

I already made the layout for the Portrait mode and created the layout-land folder and pasted all the xml files I already have to be able to adjust. From what I read, just do it but it’s not working, I removed several components from one of the screens to test and it remains the same in both modes.

xml of Landscape:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        xmlns:tools="http://schemas.android.com/tools"
        style="@style/estiloTela"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="1">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="AAAAAAAAAAA"
            android:textColor="@color/primary_text"
            android:textSize="15dp" />

</LinearLayout>
</ScrollView>

1 answer

1


Check if the structure of your resource directory looks like this:

inserir a descrição da imagem aqui

If no follow the following steps:

1) On the layout directory click : New -> Layout Resource file

2) In the File Name dialog put the same name as the source xml layout

3) In the list of Available Qualifiers select Orientation and add in the list on the right.

4) Select the orientation and click OK.

5) Copy your original layout to the new and modify.

  • It has 2 xmls files for each screen, but it did not appear "port" on the xml Portrait side, only the land appeared. Have some problem?

  • No, it’s okay, the impression is you typed something wrong. Try to create any other layout with the two guidelines, test and see the structure.

  • Check that your Androidmanifest.xml has the application tag or Activity tag -> android:screenOrientation="orientation"

  • There’s nothing in the manifest. I created a test screen the way you said it and it worked. Will I have to do this process for all screens? Has about 30 :(

  • I don’t think so! On androidStudio tab "Project" (left side vertical tab) seven the "Android" view for "Project" (horizontal tabs) and take a look at the Resource directory structure. See if the layout test was not in a different structure.

  • It came right! Thank you very much :)

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.