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

  • Home
  • SEARCH
  • 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 3959890
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:47:10+00:00 2026-05-20T02:47:10+00:00

In my app, when I click a button I was supposed to move to

  • 0

In my app, when I click a button I was supposed to move to a new page, and it shows an image. The size of the image is width 480pixels and height is 1257 pixels. The image is very clear in landscape mode where as in portrait mode it seems to be stretched. but i need to be perfect in both the sides.

The follwing is the xml code

<?xml version="1.0" encoding="UTF-8"?>
<AbsoluteLayout
android:id="@+id/finalPage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ScrollView android:id="@+id/ScrollView01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<LinearLayout android:id="@+id/LinearLayout02"
        android:layout_width="wrap_content"
        android:layout_height="30px"
        android:orientation="vertical"
        >

<ImageView
android:id="@+id/widget41"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="0px"
android:layout_y="0px"
>
</ImageView>
</LinearLayout>>
</ScrollView>>
</AbsoluteLayout>

this is to be part of my source code

public class HelpPage extends Activity 
{
    ImageView BackGroundImage;
    int width,height,orientation;

//  ImageView help;
    public void onCreate(Bundle icicle) 
    {
    super.onCreate(icicle);

    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);

    setContentView(R.layout.help);

    height = displaymetrics.heightPixels;
    width = displaymetrics.widthPixels;

    WebView webview;
    webview = (WebView) findViewById(R.id.webview);
//  webview.loadUrl("file:///android_asset/helptext.html");

    Log.e("FirstImage", "Width = "+width+"Height = "+height+" orientation= "+orientation);

    BackGroundImage = (ImageView) findViewById(R.id.widget41);
    BackGroundImage.setBackgroundResource(R.drawable.help);


     if(width == 320 && height == 480)
     {
         BackGroundImage.setBackgroundResource(R.drawable.help);
     }

     //Landscape mode of 320x480
     else if(width == 480 && height == 320)
     {
         BackGroundImage.setBackgroundResource(R.drawable.help);
     }

     //portrait mode of 480x800
     else if(width == 480 && height == 800)
     {
            BackGroundImage.setBackgroundResource(R.drawable.help);
     }

   //Landscape mode of 480x800
    else if(width == 800 && height == 480)
     {
        BackGroundImage.setBackgroundResource(R.drawable.help1);
     }

   //portrait mode of 480x854
     else if(width == 480 && height == 854)
     {      
       BackGroundImage.setBackgroundResource(R.drawable.help);
     }

   //Landscape mode of 480x854
    else if(width == 854 && height == 480)
     {
        BackGroundImage.setBackgroundResource(R.drawable.help1);
     }


//  help = new ImageView(this);
//  help = (ImageView)findViewById(R.id.helps);
    }
}

How can i solve this issue?

  • 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-20T02:47:11+00:00Added an answer on May 20, 2026 at 2:47 am

    I think that is not the way to handle this, Android can do this for you in an easier way. I recommend you read carefully this android support page: http://developer.android.com/guide/practices/screens_support.html

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

Sidebar

Related Questions

I have an app that when I click a button loads a new TabItem
I'm in the midst of writing a slide show app (click a button, and
When I click a button in my app a series of Javascript code is
In this app I want that as I click on button the data from
I am using this method on a button click. My app is not yet
In my Swing app, users can click a button to open a dialog panel
In my app I am using media picker when I click on a button
Hello StackOverflow'ers, I have a (flex) app that, on the click of a button,
In my app there is a button, user just click it then the latest
In my iphone app i am having a button, when I click on the

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.