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 7604741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:59:24+00:00 2026-05-30T23:59:24+00:00

I set the layout and scroll view for the screen resolution 480×800. How can

  • 0

I set the layout and scroll view for the screen resolution 480×800. How can I be compatible with other screen resolution?
Here is my code. Please help me.

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="150dp"
android:orientation="vertical" >
<ScrollView android:id="@+id/ScrollView01"
 android:layout_width="fill_parent"
android:layout_height="200dp"
android:background="#86C3C6" >
<TextView
        android:id="@+id/tvHistory"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#86C3C6"
        android:gravity="right"
        android:focusable="true"
        android:text=""
        android:textColor="#FFFFFF" />
 </ScrollView>
</RelativeLayout>

Please help me to set the layout,scroll view and textsize through program

  • 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-05-30T23:59:24+00:00Added an answer on May 30, 2026 at 11:59 pm

    First of all, Android does not support the concept of “screen resolution.” There’s screen size and screen (or pixel) density. Since you’re already using density-independent pixels (dp), I imagine that your question is about supporting different screen sizes.

    The way to support other screen sizes is to have size-specific resource directories. For instance, in addition to res/layout (where you probably now have the above layout file), you could have res/layout-large to support large screens. The details about this are described in the Guide topic Supporting Multiple Screens and the pages that it links to.

    You might also consider not specifying an exact size for your views, but rather let them fill the parent or wrap their content. If that doesn’t work for your layout and you need to specify view sizes, you can make the size a variable and define the size in the res/values, res/values-large, etc. folders. For instance, in res/layout/main.xml you could have your layout:

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="@dimen/relative_layout_height"
        android:orientation="vertical" >
        <ScrollView android:id="@+id/ScrollView01"
            android:layout_width="fill_parent"
            android:layout_height="@dimen/scroll_view_height"
            android:background="#86C3C6" >
            <TextView
                android:id="@+id/tvHistory"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#86C3C6"
                android:gravity="right"
                android:focusable="true"
                android:text=""
                android:textColor="#FFFFFF" />
        </ScrollView>
    </RelativeLayout>
    

    Then in each values folder you can have a dimens.xml file with the relevant dimensions given appropriate values. In res/values/dimens.xml (for medium-size screens):

    <dimen name="relative_layout_height">150dp</dimen>
    <dimen name="scroll_view_height">200dp</dimen>
    

    While in res/values-large/dimens.xml you would have:

    <dimen name="relative_layout_height">250dp</dimen>
    <dimen name="scroll_view_height">300dp</dimen>
    

    That way, you would only need one layout and it would be parameterized by dimension values that would vary by screen size.

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

Sidebar

Related Questions

Hello I need to set scroll view in following code,and set after first relative
In the layout you can set the EditText widget to be non-editable via the
is there any sort of XY-Layout to Java? So I can set a Button
how can I set scroll of scrollview to x pixels, before it's even shown?
If I set a layout on a JFrame with setLayout and then retrieve it
I'd like to set the layout's $scripts_for_layout from within the controller. Is this possible,
I have two panels: main_panel child_panel The main_panel layout is set using: main_panel.setLayout(flowlayout) I
I just can't display the button at the bottom of the screen. I have
basically I'm building a custom scroll bar that has a table layout inside it.
I want to display an image within a scroll area. The view port of

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.