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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:04:18+00:00 2026-05-25T03:04:18+00:00

Basically, the code below is what I am using to retrieve images from a

  • 0

Basically, the code below is what I am using to retrieve images from a remote server. My problem is, whenever I have large images like 700×700, it shrinks the entire image until it only fits the screen. What I really want is whenever I have large image like that, I want it to stay just the way it is and show a vertical and horizontal scrollbar instead. is this possible to accomplish?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">
 <TextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="@string/hello" />
 <ProgressBar    
   android:id="@+id/progressBar"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content" />
 <ImageView
   android:id="@+id/imageView"
   android:visibility="gone"
   android:layout_width="200dp"
   android:layout_height="200dp"/>

</LinearLayout>

Then my main activity ImageDownload.java

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;

public class ImageDownload extends Activity {
 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  ImageView mainImageView = (ImageView) findViewById(R.id.imageView);
  ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
  String imageurl = "http://4.bp.blogspot.com/-xRyw7I08tDM/TgNqD2Ij-3I/AAAAAAAAAOU/FGjboxE-u2U/s1600/cute_cat_cute_1-s357x422-47520.jpg";

  ImageDownloadMessageHandler imageDownloadMessageHandler1= new ImageDownloadMessageHandler(progressBar, mainImageView);
  ImageDownlaodThread imageDownlaodThread = new ImageDownlaodThread(imageDownloadMessageHandler1,imageurl);
  imageDownlaodThread.start();

 }

 class ImageDownlaodThread extends Thread {
  ImageDownloadMessageHandler imageDownloadMessageHandler;
  String imageUrl;

  public ImageDownlaodThread(ImageDownloadMessageHandler imageDownloadMessageHandler, String imageUrl) {
   this.imageDownloadMessageHandler = imageDownloadMessageHandler;
   this.imageUrl = imageUrl;
  }

  @Override
  public void run() {
   Drawable drawable = LoadImageFromWebOperations(imageUrl);
   Message message = imageDownloadMessageHandler.obtainMessage(1, drawable);
   imageDownloadMessageHandler.sendMessage(message);
   System.out.println("Message sent");
  }

 }

 class ImageDownloadMessageHandler extends Handler {
  ProgressBar progressBar;
  View imageTextView;

  public ImageDownloadMessageHandler(ProgressBar progressBar, View imageTextView) {
   this.progressBar = progressBar;
   this.imageTextView = imageTextView;
  }

  @Override
  public void handleMessage(Message message) {
   progressBar.setVisibility(View.GONE);
   imageTextView.setBackgroundDrawable(((Drawable) message.obj));
   imageTextView.setVisibility(View.VISIBLE);
  }

 }

 Drawable LoadImageFromWebOperations(String url) {
  Drawable d = null;
  InputStream is = null;
  try {
   is = (InputStream) new URL(url).getContent();
   d = Drawable.createFromStream(is, "src name");
  } catch (MalformedURLException e) {
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  }
  return d;
 }

}
  • 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-25T03:04:19+00:00Added an answer on May 25, 2026 at 3:04 am

    Try this:

    <ScrollView android:id="@+id/scrollView1"
        android:layout_width="fill_parent" android:layout_height="fill_parent"  xmlns:android="http://schemas.android.com/apk/res/android">
        <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent"
    android:orientation="vertical">
        <HorizontalScrollView android:id="@+id/horizontalScrollView1"
        android:layout_width="wrap_content" android:layout_height="wrap_content">
            <LinearLayout android:id="@+id/linearLayout2"
                 android:layout_width="match_parent" android:layout_height="match_parent"
                 android:orientation="horizontal">
                <TextView/>
                <ImageView/>
                <ProgressBar/>
           </LinearLayout>
          </HorizontalScrollView>
          </LinearLayout>
    </ScrollView>
    

    This way you can have both vertical and horizontal scroll.

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

Sidebar

Related Questions

I have a bit of code that basically reads an XML document using the
I have the following code, which basically takes values from a database and populates
I'm using the code below for my search logic, basically, it evaluates a field
basically I'm trying to get #toggle_box to slide down using Jquery, the code below
I have tried using the code below to display ImageIcons in JTable. But when
Basically, the code below will generate divs which are then captured using the jquery
I have javascript code like below - function initPage(){ // Left Navigation Pane -
Basically this code below returns the right information, but I need to add the
My code below won't compile. What am i doing wrong? I'm basically trying to
My code basically needs to start up a simple chat server with a client.

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.