Image changes position with different devicesStrange out of memory issue while loading an image to a Bitmap objectLazy load of images in ListViewStandard Android Button with a different colorWhat is the difference between “px”, “dip”, “dp” and “sp”?Is there a unique Android device ID?What is the difference between gravity and layout_gravity in Android?Android GridView 3 x 6 Image CroppingWhat is the difference between match_parent and fill_parent?Android - tiled backgrounds occasionally get stretchedHow to change fontFamily of TextView in Android

Why should we care about syntactic proofs if we can show semantically that statements are true?

Acceptable to cut steak before searing?

Infeasibility in mathematical optimization models

Write an interpreter for *

Best way to divide CPU along all sql instances on 1 server

Why are Gatwick's runways too close together?

Does a code snippet compile? Or does it get compiled?

Generator for parity?

Dropdowns & Chevrons for Right to Left languages

Non-OR journals which regularly publish OR research

Drawing complex inscribed and circumscribed polygons in TikZ

How do we avoid CI-driven development...?

Can I call myself an assistant professor without a PhD?

Why doesn't the "ch" pronunciation rule occur for words such as "durch" and "manchmal"?

Performance of a branch and bound algorithm VS branch-cut-heuristics

Can I legally make a real mobile app based on a fictional app from a TV show?

How to vertically align the three columns of my table top, top, middle

Strangeness with gears

In reversi, can you overwrite two chips in one move?

How can you evade tax by getting employment income just in equity, then using this equity as collateral to take out loan?

Word or idiom defining something barely functional

Unique combinations of a list of tuples

How can I tell if a flight itinerary is fake?

A stranger from Norway wants to have money delivered to me



Image changes position with different devices


Strange out of memory issue while loading an image to a Bitmap objectLazy load of images in ListViewStandard Android Button with a different colorWhat is the difference between “px”, “dip”, “dp” and “sp”?Is there a unique Android device ID?What is the difference between gravity and layout_gravity in Android?Android GridView 3 x 6 Image CroppingWhat is the difference between match_parent and fill_parent?Android - tiled backgrounds occasionally get stretchedHow to change fontFamily of TextView in Android






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am working on an app that displays a parking lot and shows the available parking spots. However, I am having issues when showing the available parking spots in different devices. The background image is the sketch of a parking lot but and the parking spots are shown available by adding a red box on top of the parking spot. But the red boxes keep changing location as I use different devices.



First, this is my XML file where I upload the image in the background and set the location for some boxes that have to be placed on top of the background image.



<RelativeLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".Map.LotDisplay">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:id="@+id/map"
android:orientation="horizontal"
android:background="@drawable/parkingmap">
</LinearLayout>

<Spot
android:id="@+id/spot0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="344dp"
android:layout_marginTop="250dp"
app:height="14dp"
app:width="33dp" />

<Spot
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spot1"
app:height="14dp"
app:width="33dp"
android:layout_marginTop="266dp"
android:layout_marginLeft="344dp"/>

</RelativeLayout>



Here is how the image should be looking:



Here is how the image should be looking



However, this is how it looks when I use a different device:



However, this is how it looks when I use a different device



Can anyone tell me why is this happening and why to fix it? I thought using dp should solve the issue but it didn't.



This is parkingmap.png referenced in the XML file:



This is parkingmap.png referenced in the XML file



Thank you!










share|improve this question





















  • 1





    That's by design-ish. the margins are constant, but the screen sizes are not. 300 dp margin places the image in a very different place on a 330dp wide device than a 700 dp wide device

    – Zoe
    Mar 21 at 16:19











  • You may try PercentRelativeLayout, this may help you "android.support.percent.PercentRelativeLayout"

    – Fra Red
    Mar 21 at 16:27

















0















I am working on an app that displays a parking lot and shows the available parking spots. However, I am having issues when showing the available parking spots in different devices. The background image is the sketch of a parking lot but and the parking spots are shown available by adding a red box on top of the parking spot. But the red boxes keep changing location as I use different devices.



First, this is my XML file where I upload the image in the background and set the location for some boxes that have to be placed on top of the background image.



<RelativeLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".Map.LotDisplay">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:id="@+id/map"
android:orientation="horizontal"
android:background="@drawable/parkingmap">
</LinearLayout>

<Spot
android:id="@+id/spot0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="344dp"
android:layout_marginTop="250dp"
app:height="14dp"
app:width="33dp" />

<Spot
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spot1"
app:height="14dp"
app:width="33dp"
android:layout_marginTop="266dp"
android:layout_marginLeft="344dp"/>

</RelativeLayout>



Here is how the image should be looking:



Here is how the image should be looking



However, this is how it looks when I use a different device:



However, this is how it looks when I use a different device



Can anyone tell me why is this happening and why to fix it? I thought using dp should solve the issue but it didn't.



This is parkingmap.png referenced in the XML file:



This is parkingmap.png referenced in the XML file



Thank you!










share|improve this question





















  • 1





    That's by design-ish. the margins are constant, but the screen sizes are not. 300 dp margin places the image in a very different place on a 330dp wide device than a 700 dp wide device

    – Zoe
    Mar 21 at 16:19











  • You may try PercentRelativeLayout, this may help you "android.support.percent.PercentRelativeLayout"

    – Fra Red
    Mar 21 at 16:27













0












0








0








I am working on an app that displays a parking lot and shows the available parking spots. However, I am having issues when showing the available parking spots in different devices. The background image is the sketch of a parking lot but and the parking spots are shown available by adding a red box on top of the parking spot. But the red boxes keep changing location as I use different devices.



First, this is my XML file where I upload the image in the background and set the location for some boxes that have to be placed on top of the background image.



<RelativeLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".Map.LotDisplay">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:id="@+id/map"
android:orientation="horizontal"
android:background="@drawable/parkingmap">
</LinearLayout>

<Spot
android:id="@+id/spot0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="344dp"
android:layout_marginTop="250dp"
app:height="14dp"
app:width="33dp" />

<Spot
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spot1"
app:height="14dp"
app:width="33dp"
android:layout_marginTop="266dp"
android:layout_marginLeft="344dp"/>

</RelativeLayout>



Here is how the image should be looking:



Here is how the image should be looking



However, this is how it looks when I use a different device:



However, this is how it looks when I use a different device



Can anyone tell me why is this happening and why to fix it? I thought using dp should solve the issue but it didn't.



This is parkingmap.png referenced in the XML file:



This is parkingmap.png referenced in the XML file



Thank you!










share|improve this question
















I am working on an app that displays a parking lot and shows the available parking spots. However, I am having issues when showing the available parking spots in different devices. The background image is the sketch of a parking lot but and the parking spots are shown available by adding a red box on top of the parking spot. But the red boxes keep changing location as I use different devices.



First, this is my XML file where I upload the image in the background and set the location for some boxes that have to be placed on top of the background image.



<RelativeLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".Map.LotDisplay">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:id="@+id/map"
android:orientation="horizontal"
android:background="@drawable/parkingmap">
</LinearLayout>

<Spot
android:id="@+id/spot0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="344dp"
android:layout_marginTop="250dp"
app:height="14dp"
app:width="33dp" />

<Spot
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spot1"
app:height="14dp"
app:width="33dp"
android:layout_marginTop="266dp"
android:layout_marginLeft="344dp"/>

</RelativeLayout>



Here is how the image should be looking:



Here is how the image should be looking



However, this is how it looks when I use a different device:



However, this is how it looks when I use a different device



Can anyone tell me why is this happening and why to fix it? I thought using dp should solve the issue but it didn't.



This is parkingmap.png referenced in the XML file:



This is parkingmap.png referenced in the XML file



Thank you!







android android-layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 10:31









deadfish

6,97210 gold badges67 silver badges115 bronze badges




6,97210 gold badges67 silver badges115 bronze badges










asked Mar 21 at 16:13









Juan Ortiz CouderJuan Ortiz Couder

85 bronze badges




85 bronze badges










  • 1





    That's by design-ish. the margins are constant, but the screen sizes are not. 300 dp margin places the image in a very different place on a 330dp wide device than a 700 dp wide device

    – Zoe
    Mar 21 at 16:19











  • You may try PercentRelativeLayout, this may help you "android.support.percent.PercentRelativeLayout"

    – Fra Red
    Mar 21 at 16:27












  • 1





    That's by design-ish. the margins are constant, but the screen sizes are not. 300 dp margin places the image in a very different place on a 330dp wide device than a 700 dp wide device

    – Zoe
    Mar 21 at 16:19











  • You may try PercentRelativeLayout, this may help you "android.support.percent.PercentRelativeLayout"

    – Fra Red
    Mar 21 at 16:27







1




1





That's by design-ish. the margins are constant, but the screen sizes are not. 300 dp margin places the image in a very different place on a 330dp wide device than a 700 dp wide device

– Zoe
Mar 21 at 16:19





That's by design-ish. the margins are constant, but the screen sizes are not. 300 dp margin places the image in a very different place on a 330dp wide device than a 700 dp wide device

– Zoe
Mar 21 at 16:19













You may try PercentRelativeLayout, this may help you "android.support.percent.PercentRelativeLayout"

– Fra Red
Mar 21 at 16:27





You may try PercentRelativeLayout, this may help you "android.support.percent.PercentRelativeLayout"

– Fra Red
Mar 21 at 16:27












2 Answers
2






active

oldest

votes


















0














Please try this one.Hope this will be work for multiple screen type



<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:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.constraint.ConstraintLayout
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/map"
android:orientation="horizontal"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">




<Spot
android:id="@+id/spot0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_26sdp"
android:layout_marginBottom="@dimen/_100sdp"
android:layout_weight="1"
android:background="@color/colorPrimaryDark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Spot
android:id="@+id/spot1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_26sdp"
android:layout_marginBottom="@dimen/_135sdp"
android:layout_weight="1"
android:background="@color/colorPrimaryDark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>




add this on Gradle file



implementation 'com.intuit.sdp:sdp-android:1.0.6'





share|improve this answer



























  • Thank you! It didn't fully work but it guided me in the right direction!

    – Juan Ortiz Couder
    Apr 12 at 17:42


















0














First of all I'm sorry that I'm posting this as an answer because I can't comment (I don't have the 50 reputations).



It's obvious that position will change because you are hardcoding layout_marginTop and marginLeft values, which should be generic for all devices.



But there is a solution, try this library android sdp .



This library will let you use sdp in the place of dp as a unit.



I hope this will help you.






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%2f55284814%2fimage-changes-position-with-different-devices%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Please try this one.Hope this will be work for multiple screen type



    <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:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/map"
    android:orientation="horizontal"
    android:scaleType="centerInside"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent">




    <Spot
    android:id="@+id/spot0"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_26sdp"
    android:layout_marginBottom="@dimen/_100sdp"
    android:layout_weight="1"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

    <Spot
    android:id="@+id/spot1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_26sdp"
    android:layout_marginBottom="@dimen/_135sdp"
    android:layout_weight="1"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
    </android.support.constraint.ConstraintLayout>




    add this on Gradle file



    implementation 'com.intuit.sdp:sdp-android:1.0.6'





    share|improve this answer



























    • Thank you! It didn't fully work but it guided me in the right direction!

      – Juan Ortiz Couder
      Apr 12 at 17:42















    0














    Please try this one.Hope this will be work for multiple screen type



    <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:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/map"
    android:orientation="horizontal"
    android:scaleType="centerInside"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent">




    <Spot
    android:id="@+id/spot0"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_26sdp"
    android:layout_marginBottom="@dimen/_100sdp"
    android:layout_weight="1"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

    <Spot
    android:id="@+id/spot1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_26sdp"
    android:layout_marginBottom="@dimen/_135sdp"
    android:layout_weight="1"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
    </android.support.constraint.ConstraintLayout>




    add this on Gradle file



    implementation 'com.intuit.sdp:sdp-android:1.0.6'





    share|improve this answer



























    • Thank you! It didn't fully work but it guided me in the right direction!

      – Juan Ortiz Couder
      Apr 12 at 17:42













    0












    0








    0







    Please try this one.Hope this will be work for multiple screen type



    <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:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/map"
    android:orientation="horizontal"
    android:scaleType="centerInside"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent">




    <Spot
    android:id="@+id/spot0"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_26sdp"
    android:layout_marginBottom="@dimen/_100sdp"
    android:layout_weight="1"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

    <Spot
    android:id="@+id/spot1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_26sdp"
    android:layout_marginBottom="@dimen/_135sdp"
    android:layout_weight="1"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
    </android.support.constraint.ConstraintLayout>




    add this on Gradle file



    implementation 'com.intuit.sdp:sdp-android:1.0.6'





    share|improve this answer















    Please try this one.Hope this will be work for multiple screen type



    <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:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/map"
    android:orientation="horizontal"
    android:scaleType="centerInside"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent">




    <Spot
    android:id="@+id/spot0"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_26sdp"
    android:layout_marginBottom="@dimen/_100sdp"
    android:layout_weight="1"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

    <Spot
    android:id="@+id/spot1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_26sdp"
    android:layout_marginBottom="@dimen/_135sdp"
    android:layout_weight="1"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
    </android.support.constraint.ConstraintLayout>




    add this on Gradle file



    implementation 'com.intuit.sdp:sdp-android:1.0.6'






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 27 at 9:48

























    answered Mar 27 at 7:38









    DEVSHKDEVSHK

    1841 silver badge5 bronze badges




    1841 silver badge5 bronze badges















    • Thank you! It didn't fully work but it guided me in the right direction!

      – Juan Ortiz Couder
      Apr 12 at 17:42

















    • Thank you! It didn't fully work but it guided me in the right direction!

      – Juan Ortiz Couder
      Apr 12 at 17:42
















    Thank you! It didn't fully work but it guided me in the right direction!

    – Juan Ortiz Couder
    Apr 12 at 17:42





    Thank you! It didn't fully work but it guided me in the right direction!

    – Juan Ortiz Couder
    Apr 12 at 17:42













    0














    First of all I'm sorry that I'm posting this as an answer because I can't comment (I don't have the 50 reputations).



    It's obvious that position will change because you are hardcoding layout_marginTop and marginLeft values, which should be generic for all devices.



    But there is a solution, try this library android sdp .



    This library will let you use sdp in the place of dp as a unit.



    I hope this will help you.






    share|improve this answer





























      0














      First of all I'm sorry that I'm posting this as an answer because I can't comment (I don't have the 50 reputations).



      It's obvious that position will change because you are hardcoding layout_marginTop and marginLeft values, which should be generic for all devices.



      But there is a solution, try this library android sdp .



      This library will let you use sdp in the place of dp as a unit.



      I hope this will help you.






      share|improve this answer



























        0












        0








        0







        First of all I'm sorry that I'm posting this as an answer because I can't comment (I don't have the 50 reputations).



        It's obvious that position will change because you are hardcoding layout_marginTop and marginLeft values, which should be generic for all devices.



        But there is a solution, try this library android sdp .



        This library will let you use sdp in the place of dp as a unit.



        I hope this will help you.






        share|improve this answer













        First of all I'm sorry that I'm posting this as an answer because I can't comment (I don't have the 50 reputations).



        It's obvious that position will change because you are hardcoding layout_marginTop and marginLeft values, which should be generic for all devices.



        But there is a solution, try this library android sdp .



        This library will let you use sdp in the place of dp as a unit.



        I hope this will help you.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 21 at 16:22









        AmineAmine

        1,0951 gold badge4 silver badges15 bronze badges




        1,0951 gold badge4 silver badges15 bronze badges






























            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%2f55284814%2fimage-changes-position-with-different-devices%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

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현