Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:52:10+00:00 2026-06-14T09:52:10+00:00

So I am new to Android development and have a question on layouts. When

  • 0

So I am new to Android development and have a question on layouts. When I create my app in Eclipse I have it set up so that I can see what it would look like on a Nexus S (4 in., 480 x 800). This looks great when I open it on my Exhibit 2 4G (3.7 in., 480 x 800), however it looks terrible when I open it on the Nexus 7. The buttons are in the wrong places and things just don’t look the same. I am assuming this has to do with layouts? When I create a Windows application in java I use a layout such as the border layout, grid layout, flow layout, etch… and then add it to the frame. That way no matter how big I resize the window, it always looks the same. How do you do this in Android? Also, kinda off topic, but when displaying numbers in a textbox how do you make it so that it only shows up to the hundredths place? I am starting out creating apps that deal with tips, sale prices, etch, and don’t need the final calculated price to be to the 5th decimal place.

Here is my layout code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Main" >

    <TextView
        android:id="@+id/tagpricetext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="18dp"
        android:layout_marginTop="21dp"
        android:text="Enter tag price:"
        android:textAppearance="?android:attr/textAppearanceLarge"
        tools:ignore="HardcodedText" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tagpricetext"
        android:layout_marginTop="36dp"
        android:layout_toLeftOf="@+id/tagprice"
        android:text="Enter % off:"
        android:textAppearance="?android:attr/textAppearanceLarge"
        tools:ignore="HardcodedText" />

    <Button
        android:id="@+id/calc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tagpricetext"
        android:layout_alignRight="@+id/percentoff"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="31dp"
        android:text="Calculate"
        tools:ignore="HardcodedText" />

    <TextView
        android:id="@+id/saleprice"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/textView2"
        android:layout_alignBottom="@+id/textView2"
        android:layout_toRightOf="@+id/textView1"
        android:text="     "
        android:textAppearance="?android:attr/textAppearanceLarge"
        tools:ignore="HardcodedText" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tagpricetext"
        android:layout_alignParentTop="true"
        android:orientation="vertical"
        tools:ignore="UselessLeaf" >

    </LinearLayout>

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/calc"
        android:layout_below="@+id/calc"
        android:layout_marginTop="20dp"
        android:text="Sale Price: $"
        android:textAppearance="?android:attr/textAppearanceLarge"
        tools:ignore="HardcodedText" />

    <EditText
        android:id="@+id/tagprice"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/tagpricetext"
        android:layout_marginLeft="18dp"
        android:layout_toRightOf="@+id/tagpricetext"
        android:ems="10"
        android:inputType="numberDecimal" >

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/percentoff"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tagprice"
        android:layout_alignTop="@+id/textView1"
        android:ems="10"
        android:inputType="numberDecimal" />

</RelativeLayout>

And here is a screenshot:
https://www.dropbox.com/sh/cq327dyhzzb1af6/PjRXqS2DWc/screenshot.jpg

Thanks in advance!

Brandon

Samsung Exhibit 2 4G (T-Mobile)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:52:11+00:00Added an answer on June 14, 2026 at 9:52 am

    This article in the developer guide covers everything you need to know about supporting different screen sizes:
    http://developer.android.com/guide/practices/screens_support.html

    If you’re looking to center everything then just tag it all with center_horizontal…

    As for your number, perhaps multiply it by 100, Math.round it, then divide it by 100?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to android apps development and I have a basic sqlite question. What
I am new to Android development. I have an activity in which I would
I am new to android development and I have a question about the insert
I'm new in Android development and I have the next question/problem. I'm playing around
I'm new in Android development and I have the next question/problem. I'm playing around
I'm new to Android development and have started creating my own UI. I see
I am new to Android development and I have a question regarding custom views
I am new to Android development and I have a question about setting weight
I'm new to Android development and have some question regarding overlays in googlemaps API.
I'm new to Android development and have some question regarding overlays in googlemaps API.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.