I need to adjust relative layout to 480 x 800 screen
i have design an calculator app
in nexus 6 resolution but when i play the app in 400 x 800 hdpi it all break
mean app don't look same one button on other corner and one on other hope you got it i want my application to work on all screen sizes my app is design in relative layout i don't want to change
help thanks
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity">
<Button
android:id="@+id/plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/minus"
android:layout_marginEnd="-103dp"
android:layout_toStartOf="@+id/minus"
android:text="+" />
<Button
android:id="@+id/Relative_Number"
android:layout_width="163dp"
android:layout_height="59dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="241dp"
android:text="Click Me" />
<Button
android:id="@+id/divide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/plus"
android:layout_marginEnd="116dp"
android:text="/" />
<Button
android:id="@+id/minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="107dp"
android:layout_marginTop="285dp"
android:text="-" />
<Button
android:id="@+id/multiply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/textView"
android:layout_alignTop="@+id/plus"
android:text="*" />
<TextView
android:id="@+id/textView"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="168dp" />
<TextView
android:id="@+id/result"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
/>
<EditText
android:id="@+id/num1"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="106dp"
android:hint="Please Enter Your First Number"
android:inputType="number" />
<EditText
android:id="@+id/num2"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="187dp"
android:hint="Please Enter Your 2nd Number"
android:inputType="number" />
</RelativeLayout>

|
show 1 more comment
i have design an calculator app
in nexus 6 resolution but when i play the app in 400 x 800 hdpi it all break
mean app don't look same one button on other corner and one on other hope you got it i want my application to work on all screen sizes my app is design in relative layout i don't want to change
help thanks
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity">
<Button
android:id="@+id/plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/minus"
android:layout_marginEnd="-103dp"
android:layout_toStartOf="@+id/minus"
android:text="+" />
<Button
android:id="@+id/Relative_Number"
android:layout_width="163dp"
android:layout_height="59dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="241dp"
android:text="Click Me" />
<Button
android:id="@+id/divide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/plus"
android:layout_marginEnd="116dp"
android:text="/" />
<Button
android:id="@+id/minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="107dp"
android:layout_marginTop="285dp"
android:text="-" />
<Button
android:id="@+id/multiply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/textView"
android:layout_alignTop="@+id/plus"
android:text="*" />
<TextView
android:id="@+id/textView"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="168dp" />
<TextView
android:id="@+id/result"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
/>
<EditText
android:id="@+id/num1"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="106dp"
android:hint="Please Enter Your First Number"
android:inputType="number" />
<EditText
android:id="@+id/num2"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="187dp"
android:hint="Please Enter Your 2nd Number"
android:inputType="number" />
</RelativeLayout>

Much of your design uses de-facto absolute positioning. Try to position elements relative to each other. Only if this is not possible for some reason, use dimensions that depend on the screen size.
– Henry
Nov 20 '18 at 6:43
@Jasir ali - you need to practice with all layout
– AD 10
Nov 20 '18 at 6:51
and dont put static size use SDP for all predefine devices- github.com/intuit/sdp
– AD 10
Nov 20 '18 at 6:52
RelativeLayout is only not a good or proper way to achieve your task
– AD 10
Nov 20 '18 at 6:53
can any one provide me solution or code
– Jasir Ali
Nov 20 '18 at 7:44
|
show 1 more comment
i have design an calculator app
in nexus 6 resolution but when i play the app in 400 x 800 hdpi it all break
mean app don't look same one button on other corner and one on other hope you got it i want my application to work on all screen sizes my app is design in relative layout i don't want to change
help thanks
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity">
<Button
android:id="@+id/plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/minus"
android:layout_marginEnd="-103dp"
android:layout_toStartOf="@+id/minus"
android:text="+" />
<Button
android:id="@+id/Relative_Number"
android:layout_width="163dp"
android:layout_height="59dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="241dp"
android:text="Click Me" />
<Button
android:id="@+id/divide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/plus"
android:layout_marginEnd="116dp"
android:text="/" />
<Button
android:id="@+id/minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="107dp"
android:layout_marginTop="285dp"
android:text="-" />
<Button
android:id="@+id/multiply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/textView"
android:layout_alignTop="@+id/plus"
android:text="*" />
<TextView
android:id="@+id/textView"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="168dp" />
<TextView
android:id="@+id/result"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
/>
<EditText
android:id="@+id/num1"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="106dp"
android:hint="Please Enter Your First Number"
android:inputType="number" />
<EditText
android:id="@+id/num2"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="187dp"
android:hint="Please Enter Your 2nd Number"
android:inputType="number" />
</RelativeLayout>

i have design an calculator app
in nexus 6 resolution but when i play the app in 400 x 800 hdpi it all break
mean app don't look same one button on other corner and one on other hope you got it i want my application to work on all screen sizes my app is design in relative layout i don't want to change
help thanks
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity">
<Button
android:id="@+id/plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/minus"
android:layout_marginEnd="-103dp"
android:layout_toStartOf="@+id/minus"
android:text="+" />
<Button
android:id="@+id/Relative_Number"
android:layout_width="163dp"
android:layout_height="59dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="241dp"
android:text="Click Me" />
<Button
android:id="@+id/divide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/plus"
android:layout_marginEnd="116dp"
android:text="/" />
<Button
android:id="@+id/minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="107dp"
android:layout_marginTop="285dp"
android:text="-" />
<Button
android:id="@+id/multiply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/textView"
android:layout_alignTop="@+id/plus"
android:text="*" />
<TextView
android:id="@+id/textView"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="168dp" />
<TextView
android:id="@+id/result"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
/>
<EditText
android:id="@+id/num1"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="106dp"
android:hint="Please Enter Your First Number"
android:inputType="number" />
<EditText
android:id="@+id/num2"
android:layout_width="381dp"
android:layout_height="63dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="187dp"
android:hint="Please Enter Your 2nd Number"
android:inputType="number" />
</RelativeLayout>


edited Nov 30 '18 at 8:59


Onik
11.3k104063
11.3k104063
asked Nov 20 '18 at 6:35
Jasir AliJasir Ali
34
34
Much of your design uses de-facto absolute positioning. Try to position elements relative to each other. Only if this is not possible for some reason, use dimensions that depend on the screen size.
– Henry
Nov 20 '18 at 6:43
@Jasir ali - you need to practice with all layout
– AD 10
Nov 20 '18 at 6:51
and dont put static size use SDP for all predefine devices- github.com/intuit/sdp
– AD 10
Nov 20 '18 at 6:52
RelativeLayout is only not a good or proper way to achieve your task
– AD 10
Nov 20 '18 at 6:53
can any one provide me solution or code
– Jasir Ali
Nov 20 '18 at 7:44
|
show 1 more comment
Much of your design uses de-facto absolute positioning. Try to position elements relative to each other. Only if this is not possible for some reason, use dimensions that depend on the screen size.
– Henry
Nov 20 '18 at 6:43
@Jasir ali - you need to practice with all layout
– AD 10
Nov 20 '18 at 6:51
and dont put static size use SDP for all predefine devices- github.com/intuit/sdp
– AD 10
Nov 20 '18 at 6:52
RelativeLayout is only not a good or proper way to achieve your task
– AD 10
Nov 20 '18 at 6:53
can any one provide me solution or code
– Jasir Ali
Nov 20 '18 at 7:44
Much of your design uses de-facto absolute positioning. Try to position elements relative to each other. Only if this is not possible for some reason, use dimensions that depend on the screen size.
– Henry
Nov 20 '18 at 6:43
Much of your design uses de-facto absolute positioning. Try to position elements relative to each other. Only if this is not possible for some reason, use dimensions that depend on the screen size.
– Henry
Nov 20 '18 at 6:43
@Jasir ali - you need to practice with all layout
– AD 10
Nov 20 '18 at 6:51
@Jasir ali - you need to practice with all layout
– AD 10
Nov 20 '18 at 6:51
and dont put static size use SDP for all predefine devices- github.com/intuit/sdp
– AD 10
Nov 20 '18 at 6:52
and dont put static size use SDP for all predefine devices- github.com/intuit/sdp
– AD 10
Nov 20 '18 at 6:52
RelativeLayout is only not a good or proper way to achieve your task
– AD 10
Nov 20 '18 at 6:53
RelativeLayout is only not a good or proper way to achieve your task
– AD 10
Nov 20 '18 at 6:53
can any one provide me solution or code
– Jasir Ali
Nov 20 '18 at 7:44
can any one provide me solution or code
– Jasir Ali
Nov 20 '18 at 7:44
|
show 1 more comment
0
active
oldest
votes
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387506%2fi-need-to-adjust-relative-layout-to-480-x-800-screen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387506%2fi-need-to-adjust-relative-layout-to-480-x-800-screen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Much of your design uses de-facto absolute positioning. Try to position elements relative to each other. Only if this is not possible for some reason, use dimensions that depend on the screen size.
– Henry
Nov 20 '18 at 6:43
@Jasir ali - you need to practice with all layout
– AD 10
Nov 20 '18 at 6:51
and dont put static size use SDP for all predefine devices- github.com/intuit/sdp
– AD 10
Nov 20 '18 at 6:52
RelativeLayout is only not a good or proper way to achieve your task
– AD 10
Nov 20 '18 at 6:53
can any one provide me solution or code
– Jasir Ali
Nov 20 '18 at 7:44