Problem in sizing Android Studio screen

1

I hope you can help me, I'm new to this, and I started doing a calculator but when installing the apk on a cell phone the screen is not complete, I enclose the xml, I think the problem is in the GridLayout but I can not identify the error, in advance many thanks

<TextView
    android:id="@+id/Etiqueta"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/gridLayout"
    android:layout_marginBottom="10dp"
    android:height="120dp"
    android:textColor="#F5F5F5"
    android:textSize="35dp" />

<GridLayout
    android:id="@+id/gridLayout"

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentStart="true"
    android:layout_gravity="center"
    android:columnCount="4"
    android:orientation="horizontal"
    android:padding="0dp"
    android:rowCount="7"
    android:layout_alignParentLeft="true">

    <Button
        android:id="@+id/Clean"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="C"
        android:textColor="#222" />

    <Button
        android:id="@+id/Divide"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="/"
        android:textColor="#222" />

    <Button
        android:id="@+id/Multiplica"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="X"
        android:textColor="#222" />

    <Button
        android:id="@+id/Borrar"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="Del"
        android:textColor="#222" />

    <Button
        android:id="@+id/Siete"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="7"
        android:textColor="#222" />

    <Button
        android:id="@+id/Ocho"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="8"
        android:textColor="#222" />

    <Button
        android:id="@+id/Nueve"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="9"
        android:textColor="#222" />

    <Button
        android:id="@+id/Resta"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="-"
        android:textColor="#222" />

    <Button
        android:id="@+id/Cuatro"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="4"
        android:textColor="#222" />

    <Button
        android:id="@+id/Cinco"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="5"
        android:textColor="#222" />

    <Button
        android:id="@+id/Seis"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="6"
        android:textColor="#222" />

    <Button
        android:id="@+id/Suma"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="+"
        android:textColor="#222" />

    <Button
        android:id="@+id/Uno"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="1"
        android:textColor="#222" />

    <Button
        android:id="@+id/Dos"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="2"
        android:textColor="#222" />

    <Button
        android:id="@+id/Tres"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="3"
        android:textColor="#222" />

    <Button
        android:id="@+id/Signo"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="(+/-)"
        android:textColor="#222" />

    <Button
        android:id="@+id/Cero"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="0"
        android:textColor="#222" />

    <Button
        android:id="@+id/Punto"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="."
        android:textColor="#222" />

    <Button
        android:id="@+id/Factorial"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="x!"
        android:textColor="#222" />

    <Button
        android:id="@+id/Igual"
        android:layout_width="wrap_content"
        android:layout_gravity="fill_vertical"
        android:layout_rowSpan="2"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="="
        android:textSize="40dp"
        android:textColor="#222" />

    <Button
        android:id="@+id/Raiz"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="v"
        android:textColor="#222" />

    <Button
        android:id="@+id/Porcentaje"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="%"
        android:textColor="#222" />

    <Button
        android:id="@+id/Potencia"
        android:layout_width="wrap_content"
        android:layout_margin="2dp"
        android:background="#82228888"
        android:text="x^"
        android:textColor="#222" />
</GridLayout>

here you see the problem on the screen, the right part does not come out completely, I hope you can help me, I've already tried several things

    
asked by Andres 31.12.2018 в 14:52
source

1 answer

0

You should create another "values" folder within the res. You must right click and select the option "android resource directory", then you will see a window saying the name of the directory and the type of resource, you must first change the type of resources to values, then in "available qualifiers" you must select " screen width ", that option would be a parameter, from there you have to click on a date like this" > > ", a text field will appear where you will have to put the value to the parameter you selected" screen width ", that value can be the one you want, example: 480, 640, 720, etc (When you put the value, only the name of the directory will be set).

These would be the values for each cell phone screen. Suddenly you get confused a bit, but I'll explain, you have to create your mobile application again to adapt to each cell (obviously only in the frontend), it will seem, annoying but this is Android studio, those folders when you upload it to the play store, the user when downloading your app, the playstore itself detects what size is your cell phone and depending on that value sends the "value" folder, if it is a cell phone that has a dimension of 640x1136 the playstore sends the folder "value-640", if it is a 750x1334 cell phone, it sends you the "value-750" folder, obviously you must create those folders, so it is understood that you must create your app many times or depending on what you need, you suddenly want to run on 3 cell models, then you would be creating 3 value folders.

What I was forgetting, inside that folder you must create your xml file, you must right click on that folder and give it in "values resource file", you must give it the name "dimens". There you have to create dimension labels with their respective name, inside those labels you must put a value, example: 24dp, 20sp, etc.

Finally in your designs, before you put a value on a title or a button, you must put the name of the name tag that you put in your xml dimens. That would be practically everything.

Now, with regard to your "GridLayout" I explain to you, suddenly you are seeing in the preview of the cell phone that gives you Android studio that is all even and in place, but surely your cell phone must have other dimensions than the cell that you see in android studio, at the time of installation it will be distorted, it has already happened to me several times.

I hope you have served a lot, here I leave you a tutorial in case you did not understand, and I apologize for so much talk but that is what you have to know about the dimensions.

Postscript: I forgot to tell you that your GridLayout is fine :) There's no problem in that.

link

    
answered by 31.12.2018 / 17:28
source