Using Constraintlayout and dp, layout sizes different in real device The Next CEO of Stack OverflowIs it advisable to use LinearLayout inside ConstraintLayout in Android?Fling gesture detection on grid layoutWhat is the difference between “px”, “dip”, “dp” and “sp”?Is there a unique Android device ID?Get the size of the screen, current web page and browser windowWhat is the difference between gravity and layout_gravity in Android?Android Drawing Separator/Divider Line in Layout?LinearLayout problemDynamically change the width of a button in AndroidWhat is the difference between match_parent and fill_parent?What's “tools:context” in Android layout files?

Calculating discount not working

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

How can I prove that a state of equilibrium is unstable?

Which acid/base does a strong base/acid react when added to a buffer solution?

How exploitable/balanced is this homebrew spell: Spell Permanency?

Is it possible to create a QR code using text?

Is the offspring between a demon and a celestial possible? If so what is it called and is it in a book somewhere?

Can you teleport closer to a creature you are Frightened of?

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

What day is it again?

Gauss' Posthumous Publications?

What happens if you break a law in another country outside of that country?

How to unfasten electrical subpanel attached with ramset

Calculate the Mean mean of two numbers

Can I cast Thunderwave and be at the center of its bottom face, but not be affected by it?

Why doesn't Shulchan Aruch include the laws of destroying fruit trees?

How can a day be of 24 hours?

Prodigo = pro + ago?

Finitely generated matrix groups whose eigenvalues are all algebraic

Car headlights in a world without electricity

How to implement Comparable so it is consistent with identity-equality

Compilation of a 2d array and a 1d array

Does int main() need a declaration on C++?

Could a dragon use its wings to swim?



Using Constraintlayout and dp, layout sizes different in real device



The Next CEO of Stack OverflowIs it advisable to use LinearLayout inside ConstraintLayout in Android?Fling gesture detection on grid layoutWhat is the difference between “px”, “dip”, “dp” and “sp”?Is there a unique Android device ID?Get the size of the screen, current web page and browser windowWhat is the difference between gravity and layout_gravity in Android?Android Drawing Separator/Divider Line in Layout?LinearLayout problemDynamically change the width of a button in AndroidWhat is the difference between match_parent and fill_parent?What's “tools:context” in Android layout files?










0















I have several activities similar to the one shown in the pictures, I use Constraintlayout and linear layouts in all of them, everything set up in dp and sp. But it looks different in the emulator than in real devices. The left picture is from the emulator and the right from a Huawei. I read some documentation and they recommend using constraintlayouts and dp, which I'm already doing. None of the sizes are changed programatically. I've tried using layout_weight too with no success so I don't know what I'm missing.



<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_activity_animation_list"
tools:context=".MainActivity">

<LinearLayout
android:id="@+id/laySimbol"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/buttonShadeInici"
android:orientation="horizontal">

<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="77dp"
android:layout_gravity="center_vertical"
android:background="@android:color/transparent"
android:text="⟁"
android:textColor="@color/blueShade27"
android:textSize="50sp"
android:textStyle="bold" />

<Button
android:id="@+id/buttonScore"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="30dp"
android:layout_weight="1"
android:background="@drawable/buttonlevelscore"
android:foregroundGravity="center"
android:text="1.254"
android:textColor="@color/blueShade62"
android:textSize="20sp"
android:textStyle="bold" />

<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:clickable="false"
tools:context="com.example.root.exercicis.MainActivity">

<com.example.root.exercicis.LikeButtonView

android:id="@+id/LikeButtonView"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="30dp"
android:clickable="false" />
</FrameLayout>

<ImageView
android:id="@+id/imageViewPopUp2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:foregroundGravity="right"
android:onClick="ShowPopup"
android:paddingRight="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/verticalLayout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@android:drawable/ic_menu_sort_alphabetically" />

</LinearLayout>

<LinearLayout
android:id="@+id/verticalLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/layout_preguntes"
android:gravity="center"
android:orientation="vertical"
android:padding="25dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/laySimbol">

<TextView
android:id="@+id/preguntaView"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="TextView"
android:textColor="@android:color/background_light"
android:textSize="30sp"
app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/respostaButton1"
android:layout_width="300dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:layout_marginBottom="20dp"
android:background="@drawable/buttons_resposta_corners_top"
android:color="#64686868"
android:gravity="center"
android:onClick="OnClickButton"
android:paddingBottom="0dp"
android:tag="0"
android:text="Button"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="30sp" />


<Button
android:id="@+id/respostaButton2"
android:layout_width="300dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:background="@drawable/buttons"
android:gravity="center"
android:onClick="OnClickButton"
android:paddingBottom="0dp"
android:tag="1"
android:text="Button"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="30sp" />

<Button
android:id="@+id/respostaButton3"
android:layout_width="300dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:background="@drawable/buttons"
android:gravity="center"
android:onClick="OnClickButton"
android:paddingBottom="0dp"
android:tag="2"
android:text="Button"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="30sp" />

<Button
android:id="@+id/respostaButton4"
android:layout_width="300dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:background="@drawable/buttons_resposta_corners_bottom"
android:gravity="center"
android:onClick="OnClickButton"
android:paddingBottom="0dp"
android:tag="3"
android:text="Button"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="30sp" />

</LinearLayout>













share|improve this question


























    0















    I have several activities similar to the one shown in the pictures, I use Constraintlayout and linear layouts in all of them, everything set up in dp and sp. But it looks different in the emulator than in real devices. The left picture is from the emulator and the right from a Huawei. I read some documentation and they recommend using constraintlayouts and dp, which I'm already doing. None of the sizes are changed programatically. I've tried using layout_weight too with no success so I don't know what I'm missing.



    <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/constraintLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/main_activity_animation_list"
    tools:context=".MainActivity">

    <LinearLayout
    android:id="@+id/laySimbol"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:background="@color/buttonShadeInici"
    android:orientation="horizontal">

    <Button
    android:id="@+id/button6"
    android:layout_width="wrap_content"
    android:layout_height="77dp"
    android:layout_gravity="center_vertical"
    android:background="@android:color/transparent"
    android:text="⟁"
    android:textColor="@color/blueShade27"
    android:textSize="50sp"
    android:textStyle="bold" />

    <Button
    android:id="@+id/buttonScore"
    android:layout_width="wrap_content"
    android:layout_height="40dp"
    android:layout_gravity="center_vertical"
    android:layout_marginLeft="30dp"
    android:layout_weight="1"
    android:background="@drawable/buttonlevelscore"
    android:foregroundGravity="center"
    android:text="1.254"
    android:textColor="@color/blueShade62"
    android:textSize="20sp"
    android:textStyle="bold" />

    <FrameLayout
    android:id="@+id/frameLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:clickable="false"
    tools:context="com.example.root.exercicis.MainActivity">

    <com.example.root.exercicis.LikeButtonView

    android:id="@+id/LikeButtonView"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_gravity="center"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="30dp"
    android:clickable="false" />
    </FrameLayout>

    <ImageView
    android:id="@+id/imageViewPopUp2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:foregroundGravity="right"
    android:onClick="ShowPopup"
    android:paddingRight="10dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toStartOf="@+id/verticalLayout"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@android:drawable/ic_menu_sort_alphabetically" />

    </LinearLayout>

    <LinearLayout
    android:id="@+id/verticalLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/layout_preguntes"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="25dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/laySimbol">

    <TextView
    android:id="@+id/preguntaView"
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:text="TextView"
    android:textColor="@android:color/background_light"
    android:textSize="30sp"
    app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

    <Button
    android:id="@+id/respostaButton1"
    android:layout_width="300dp"
    android:layout_height="60dp"
    android:layout_gravity="center"
    android:layout_marginTop="40dp"
    android:layout_marginBottom="20dp"
    android:background="@drawable/buttons_resposta_corners_top"
    android:color="#64686868"
    android:gravity="center"
    android:onClick="OnClickButton"
    android:paddingBottom="0dp"
    android:tag="0"
    android:text="Button"
    android:textAllCaps="false"
    android:textColor="#FFFFFF"
    android:textSize="30sp" />


    <Button
    android:id="@+id/respostaButton2"
    android:layout_width="300dp"
    android:layout_height="60dp"
    android:layout_gravity="center"
    android:layout_marginBottom="20dp"
    android:background="@drawable/buttons"
    android:gravity="center"
    android:onClick="OnClickButton"
    android:paddingBottom="0dp"
    android:tag="1"
    android:text="Button"
    android:textAllCaps="false"
    android:textColor="#FFFFFF"
    android:textSize="30sp" />

    <Button
    android:id="@+id/respostaButton3"
    android:layout_width="300dp"
    android:layout_height="60dp"
    android:layout_gravity="center"
    android:layout_marginBottom="20dp"
    android:background="@drawable/buttons"
    android:gravity="center"
    android:onClick="OnClickButton"
    android:paddingBottom="0dp"
    android:tag="2"
    android:text="Button"
    android:textAllCaps="false"
    android:textColor="#FFFFFF"
    android:textSize="30sp" />

    <Button
    android:id="@+id/respostaButton4"
    android:layout_width="300dp"
    android:layout_height="60dp"
    android:layout_gravity="center"
    android:layout_marginBottom="20dp"
    android:background="@drawable/buttons_resposta_corners_bottom"
    android:gravity="center"
    android:onClick="OnClickButton"
    android:paddingBottom="0dp"
    android:tag="3"
    android:text="Button"
    android:textAllCaps="false"
    android:textColor="#FFFFFF"
    android:textSize="30sp" />

    </LinearLayout>













    share|improve this question
























      0












      0








      0








      I have several activities similar to the one shown in the pictures, I use Constraintlayout and linear layouts in all of them, everything set up in dp and sp. But it looks different in the emulator than in real devices. The left picture is from the emulator and the right from a Huawei. I read some documentation and they recommend using constraintlayouts and dp, which I'm already doing. None of the sizes are changed programatically. I've tried using layout_weight too with no success so I don't know what I'm missing.



      <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/constraintLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/main_activity_animation_list"
      tools:context=".MainActivity">

      <LinearLayout
      android:id="@+id/laySimbol"
      android:layout_width="match_parent"
      android:layout_height="60dp"
      android:background="@color/buttonShadeInici"
      android:orientation="horizontal">

      <Button
      android:id="@+id/button6"
      android:layout_width="wrap_content"
      android:layout_height="77dp"
      android:layout_gravity="center_vertical"
      android:background="@android:color/transparent"
      android:text="⟁"
      android:textColor="@color/blueShade27"
      android:textSize="50sp"
      android:textStyle="bold" />

      <Button
      android:id="@+id/buttonScore"
      android:layout_width="wrap_content"
      android:layout_height="40dp"
      android:layout_gravity="center_vertical"
      android:layout_marginLeft="30dp"
      android:layout_weight="1"
      android:background="@drawable/buttonlevelscore"
      android:foregroundGravity="center"
      android:text="1.254"
      android:textColor="@color/blueShade62"
      android:textSize="20sp"
      android:textStyle="bold" />

      <FrameLayout
      android:id="@+id/frameLayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical"
      android:clickable="false"
      tools:context="com.example.root.exercicis.MainActivity">

      <com.example.root.exercicis.LikeButtonView

      android:id="@+id/LikeButtonView"
      android:layout_width="60dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginLeft="10dp"
      android:layout_marginRight="30dp"
      android:clickable="false" />
      </FrameLayout>

      <ImageView
      android:id="@+id/imageViewPopUp2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical"
      android:foregroundGravity="right"
      android:onClick="ShowPopup"
      android:paddingRight="10dp"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toStartOf="@+id/verticalLayout"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      app:srcCompat="@android:drawable/ic_menu_sort_alphabetically" />

      </LinearLayout>

      <LinearLayout
      android:id="@+id/verticalLayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="@drawable/layout_preguntes"
      android:gravity="center"
      android:orientation="vertical"
      android:padding="25dp"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintHorizontal_bias="0.5"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/laySimbol">

      <TextView
      android:id="@+id/preguntaView"
      android:layout_width="300dp"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:text="TextView"
      android:textColor="@android:color/background_light"
      android:textSize="30sp"
      app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent" />

      <Button
      android:id="@+id/respostaButton1"
      android:layout_width="300dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginTop="40dp"
      android:layout_marginBottom="20dp"
      android:background="@drawable/buttons_resposta_corners_top"
      android:color="#64686868"
      android:gravity="center"
      android:onClick="OnClickButton"
      android:paddingBottom="0dp"
      android:tag="0"
      android:text="Button"
      android:textAllCaps="false"
      android:textColor="#FFFFFF"
      android:textSize="30sp" />


      <Button
      android:id="@+id/respostaButton2"
      android:layout_width="300dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginBottom="20dp"
      android:background="@drawable/buttons"
      android:gravity="center"
      android:onClick="OnClickButton"
      android:paddingBottom="0dp"
      android:tag="1"
      android:text="Button"
      android:textAllCaps="false"
      android:textColor="#FFFFFF"
      android:textSize="30sp" />

      <Button
      android:id="@+id/respostaButton3"
      android:layout_width="300dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginBottom="20dp"
      android:background="@drawable/buttons"
      android:gravity="center"
      android:onClick="OnClickButton"
      android:paddingBottom="0dp"
      android:tag="2"
      android:text="Button"
      android:textAllCaps="false"
      android:textColor="#FFFFFF"
      android:textSize="30sp" />

      <Button
      android:id="@+id/respostaButton4"
      android:layout_width="300dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginBottom="20dp"
      android:background="@drawable/buttons_resposta_corners_bottom"
      android:gravity="center"
      android:onClick="OnClickButton"
      android:paddingBottom="0dp"
      android:tag="3"
      android:text="Button"
      android:textAllCaps="false"
      android:textColor="#FFFFFF"
      android:textSize="30sp" />

      </LinearLayout>













      share|improve this question














      I have several activities similar to the one shown in the pictures, I use Constraintlayout and linear layouts in all of them, everything set up in dp and sp. But it looks different in the emulator than in real devices. The left picture is from the emulator and the right from a Huawei. I read some documentation and they recommend using constraintlayouts and dp, which I'm already doing. None of the sizes are changed programatically. I've tried using layout_weight too with no success so I don't know what I'm missing.



      <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/constraintLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/main_activity_animation_list"
      tools:context=".MainActivity">

      <LinearLayout
      android:id="@+id/laySimbol"
      android:layout_width="match_parent"
      android:layout_height="60dp"
      android:background="@color/buttonShadeInici"
      android:orientation="horizontal">

      <Button
      android:id="@+id/button6"
      android:layout_width="wrap_content"
      android:layout_height="77dp"
      android:layout_gravity="center_vertical"
      android:background="@android:color/transparent"
      android:text="⟁"
      android:textColor="@color/blueShade27"
      android:textSize="50sp"
      android:textStyle="bold" />

      <Button
      android:id="@+id/buttonScore"
      android:layout_width="wrap_content"
      android:layout_height="40dp"
      android:layout_gravity="center_vertical"
      android:layout_marginLeft="30dp"
      android:layout_weight="1"
      android:background="@drawable/buttonlevelscore"
      android:foregroundGravity="center"
      android:text="1.254"
      android:textColor="@color/blueShade62"
      android:textSize="20sp"
      android:textStyle="bold" />

      <FrameLayout
      android:id="@+id/frameLayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical"
      android:clickable="false"
      tools:context="com.example.root.exercicis.MainActivity">

      <com.example.root.exercicis.LikeButtonView

      android:id="@+id/LikeButtonView"
      android:layout_width="60dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginLeft="10dp"
      android:layout_marginRight="30dp"
      android:clickable="false" />
      </FrameLayout>

      <ImageView
      android:id="@+id/imageViewPopUp2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical"
      android:foregroundGravity="right"
      android:onClick="ShowPopup"
      android:paddingRight="10dp"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toStartOf="@+id/verticalLayout"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      app:srcCompat="@android:drawable/ic_menu_sort_alphabetically" />

      </LinearLayout>

      <LinearLayout
      android:id="@+id/verticalLayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="@drawable/layout_preguntes"
      android:gravity="center"
      android:orientation="vertical"
      android:padding="25dp"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintHorizontal_bias="0.5"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/laySimbol">

      <TextView
      android:id="@+id/preguntaView"
      android:layout_width="300dp"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:text="TextView"
      android:textColor="@android:color/background_light"
      android:textSize="30sp"
      app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent" />

      <Button
      android:id="@+id/respostaButton1"
      android:layout_width="300dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginTop="40dp"
      android:layout_marginBottom="20dp"
      android:background="@drawable/buttons_resposta_corners_top"
      android:color="#64686868"
      android:gravity="center"
      android:onClick="OnClickButton"
      android:paddingBottom="0dp"
      android:tag="0"
      android:text="Button"
      android:textAllCaps="false"
      android:textColor="#FFFFFF"
      android:textSize="30sp" />


      <Button
      android:id="@+id/respostaButton2"
      android:layout_width="300dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginBottom="20dp"
      android:background="@drawable/buttons"
      android:gravity="center"
      android:onClick="OnClickButton"
      android:paddingBottom="0dp"
      android:tag="1"
      android:text="Button"
      android:textAllCaps="false"
      android:textColor="#FFFFFF"
      android:textSize="30sp" />

      <Button
      android:id="@+id/respostaButton3"
      android:layout_width="300dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginBottom="20dp"
      android:background="@drawable/buttons"
      android:gravity="center"
      android:onClick="OnClickButton"
      android:paddingBottom="0dp"
      android:tag="2"
      android:text="Button"
      android:textAllCaps="false"
      android:textColor="#FFFFFF"
      android:textSize="30sp" />

      <Button
      android:id="@+id/respostaButton4"
      android:layout_width="300dp"
      android:layout_height="60dp"
      android:layout_gravity="center"
      android:layout_marginBottom="20dp"
      android:background="@drawable/buttons_resposta_corners_bottom"
      android:gravity="center"
      android:onClick="OnClickButton"
      android:paddingBottom="0dp"
      android:tag="3"
      android:text="Button"
      android:textAllCaps="false"
      android:textColor="#FFFFFF"
      android:textSize="30sp" />

      </LinearLayout>










      android layout






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 19:32









      Croqueta Fregida Amb PastanagaCroqueta Fregida Amb Pastanaga

      146




      146






















          3 Answers
          3






          active

          oldest

          votes


















          0














          You can solve this problem by using SDP(Scalable dp): https://github.com/intuit/sdp



          @dimen/_1sdp // Change value before sdp keyword





          share|improve this answer























          • Worked really well

            – Croqueta Fregida Amb Pastanaga
            Mar 7 at 20:40


















          0














          Firstly, you should note that "dp" is dependent upon the pixel density of the device's screen.

          That said, it's not surprising that they would show up differently on the Emulator vs a Real Device.

          I would be willing to bet that the dpi or resolution of the Emulator vs the Real device, are different.


          That aside - what exactly is the desired effect you're trying to achieve across all devices?

          Or rather, what is it that you are disliking and trying to stop from happening?

          Knowing these things would be very helpful for me to identify what the culprit is, or what you should change.






          share|improve this answer























          • Well, I'm trying to get the same look in all devices. But the main thing is that sometimes it overlaps wih other items and it makes it visually painfull.

            – Croqueta Fregida Amb Pastanaga
            Mar 7 at 20:13


















          0














          You probably won't have the same look in all devices. It's not just the number of pixels and resolution that are different, you also have different screen ratios and density.
          About the view overlaping, it's important to set constraints on every constraint layout's child. You are missing the constraints on the first linear layout.



          <LinearLayout
          android:id="@+id/laySimbol"
          android:layout_width="match_parent"
          android:layout_height="60dp"
          android:background="@color/buttonShadeInici"
          android:orientation="horizontal"
          app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent">


          Also, you are setting constraints on a linearlayout child, it won't work.



          My recommendation is to review your layout, set all constraints and don't use linear layout inside a constraint, it's not needed.
          Check this.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051495%2fusing-constraintlayout-and-dp-layout-sizes-different-in-real-device%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You can solve this problem by using SDP(Scalable dp): https://github.com/intuit/sdp



            @dimen/_1sdp // Change value before sdp keyword





            share|improve this answer























            • Worked really well

              – Croqueta Fregida Amb Pastanaga
              Mar 7 at 20:40















            0














            You can solve this problem by using SDP(Scalable dp): https://github.com/intuit/sdp



            @dimen/_1sdp // Change value before sdp keyword





            share|improve this answer























            • Worked really well

              – Croqueta Fregida Amb Pastanaga
              Mar 7 at 20:40













            0












            0








            0







            You can solve this problem by using SDP(Scalable dp): https://github.com/intuit/sdp



            @dimen/_1sdp // Change value before sdp keyword





            share|improve this answer













            You can solve this problem by using SDP(Scalable dp): https://github.com/intuit/sdp



            @dimen/_1sdp // Change value before sdp keyword






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 7 at 19:39









            twenk11ktwenk11k

            151210




            151210












            • Worked really well

              – Croqueta Fregida Amb Pastanaga
              Mar 7 at 20:40

















            • Worked really well

              – Croqueta Fregida Amb Pastanaga
              Mar 7 at 20:40
















            Worked really well

            – Croqueta Fregida Amb Pastanaga
            Mar 7 at 20:40





            Worked really well

            – Croqueta Fregida Amb Pastanaga
            Mar 7 at 20:40













            0














            Firstly, you should note that "dp" is dependent upon the pixel density of the device's screen.

            That said, it's not surprising that they would show up differently on the Emulator vs a Real Device.

            I would be willing to bet that the dpi or resolution of the Emulator vs the Real device, are different.


            That aside - what exactly is the desired effect you're trying to achieve across all devices?

            Or rather, what is it that you are disliking and trying to stop from happening?

            Knowing these things would be very helpful for me to identify what the culprit is, or what you should change.






            share|improve this answer























            • Well, I'm trying to get the same look in all devices. But the main thing is that sometimes it overlaps wih other items and it makes it visually painfull.

              – Croqueta Fregida Amb Pastanaga
              Mar 7 at 20:13















            0














            Firstly, you should note that "dp" is dependent upon the pixel density of the device's screen.

            That said, it's not surprising that they would show up differently on the Emulator vs a Real Device.

            I would be willing to bet that the dpi or resolution of the Emulator vs the Real device, are different.


            That aside - what exactly is the desired effect you're trying to achieve across all devices?

            Or rather, what is it that you are disliking and trying to stop from happening?

            Knowing these things would be very helpful for me to identify what the culprit is, or what you should change.






            share|improve this answer























            • Well, I'm trying to get the same look in all devices. But the main thing is that sometimes it overlaps wih other items and it makes it visually painfull.

              – Croqueta Fregida Amb Pastanaga
              Mar 7 at 20:13













            0












            0








            0







            Firstly, you should note that "dp" is dependent upon the pixel density of the device's screen.

            That said, it's not surprising that they would show up differently on the Emulator vs a Real Device.

            I would be willing to bet that the dpi or resolution of the Emulator vs the Real device, are different.


            That aside - what exactly is the desired effect you're trying to achieve across all devices?

            Or rather, what is it that you are disliking and trying to stop from happening?

            Knowing these things would be very helpful for me to identify what the culprit is, or what you should change.






            share|improve this answer













            Firstly, you should note that "dp" is dependent upon the pixel density of the device's screen.

            That said, it's not surprising that they would show up differently on the Emulator vs a Real Device.

            I would be willing to bet that the dpi or resolution of the Emulator vs the Real device, are different.


            That aside - what exactly is the desired effect you're trying to achieve across all devices?

            Or rather, what is it that you are disliking and trying to stop from happening?

            Knowing these things would be very helpful for me to identify what the culprit is, or what you should change.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 7 at 19:51









            Studio2bDesignsStudio2bDesigns

            1439




            1439












            • Well, I'm trying to get the same look in all devices. But the main thing is that sometimes it overlaps wih other items and it makes it visually painfull.

              – Croqueta Fregida Amb Pastanaga
              Mar 7 at 20:13

















            • Well, I'm trying to get the same look in all devices. But the main thing is that sometimes it overlaps wih other items and it makes it visually painfull.

              – Croqueta Fregida Amb Pastanaga
              Mar 7 at 20:13
















            Well, I'm trying to get the same look in all devices. But the main thing is that sometimes it overlaps wih other items and it makes it visually painfull.

            – Croqueta Fregida Amb Pastanaga
            Mar 7 at 20:13





            Well, I'm trying to get the same look in all devices. But the main thing is that sometimes it overlaps wih other items and it makes it visually painfull.

            – Croqueta Fregida Amb Pastanaga
            Mar 7 at 20:13











            0














            You probably won't have the same look in all devices. It's not just the number of pixels and resolution that are different, you also have different screen ratios and density.
            About the view overlaping, it's important to set constraints on every constraint layout's child. You are missing the constraints on the first linear layout.



            <LinearLayout
            android:id="@+id/laySimbol"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:background="@color/buttonShadeInici"
            android:orientation="horizontal"
            app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">


            Also, you are setting constraints on a linearlayout child, it won't work.



            My recommendation is to review your layout, set all constraints and don't use linear layout inside a constraint, it's not needed.
            Check this.






            share|improve this answer



























              0














              You probably won't have the same look in all devices. It's not just the number of pixels and resolution that are different, you also have different screen ratios and density.
              About the view overlaping, it's important to set constraints on every constraint layout's child. You are missing the constraints on the first linear layout.



              <LinearLayout
              android:id="@+id/laySimbol"
              android:layout_width="match_parent"
              android:layout_height="60dp"
              android:background="@color/buttonShadeInici"
              android:orientation="horizontal"
              app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintTop_toTopOf="parent">


              Also, you are setting constraints on a linearlayout child, it won't work.



              My recommendation is to review your layout, set all constraints and don't use linear layout inside a constraint, it's not needed.
              Check this.






              share|improve this answer

























                0












                0








                0







                You probably won't have the same look in all devices. It's not just the number of pixels and resolution that are different, you also have different screen ratios and density.
                About the view overlaping, it's important to set constraints on every constraint layout's child. You are missing the constraints on the first linear layout.



                <LinearLayout
                android:id="@+id/laySimbol"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:background="@color/buttonShadeInici"
                android:orientation="horizontal"
                app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">


                Also, you are setting constraints on a linearlayout child, it won't work.



                My recommendation is to review your layout, set all constraints and don't use linear layout inside a constraint, it's not needed.
                Check this.






                share|improve this answer













                You probably won't have the same look in all devices. It's not just the number of pixels and resolution that are different, you also have different screen ratios and density.
                About the view overlaping, it's important to set constraints on every constraint layout's child. You are missing the constraints on the first linear layout.



                <LinearLayout
                android:id="@+id/laySimbol"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:background="@color/buttonShadeInici"
                android:orientation="horizontal"
                app:layout_constraintBottom_toTopOf="@+id/verticalLayout"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">


                Also, you are setting constraints on a linearlayout child, it won't work.



                My recommendation is to review your layout, set all constraints and don't use linear layout inside a constraint, it's not needed.
                Check this.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 7 at 20:24









                MassitaMassita

                313110




                313110



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051495%2fusing-constraintlayout-and-dp-layout-sizes-different-in-real-device%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    1928 у кіно

                    Захаров Федір Захарович

                    Ель Греко