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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:46:46+00:00 2026-06-02T14:46:46+00:00

I am trying to add images to scrollview dynamically. To add images to scrollview

  • 0

I am trying to add images to scrollview dynamically. To add images to scrollview I am using this code:

        LinearLayout sv = (LinearLayout)findViewById( R.id.filesScrollerLayout);
        ImageView iv = new ImageView(this);
        iv.setImageDrawable( new BitmapDrawable( pub.FirstPicture ) ); // same happens with ScaleDrawable.
        iv.setScaleType( ScaleType.CENTER_INSIDE );
        sv.addView( iv ); 


<ScrollView
    android:id="@+id/scrollView2"
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentTop="true"
    android:layout_toRightOf="@+id/scrollView1"
    android:background="#FFFF00" >

    <LinearLayout
        android:id="@+id/filesScrollerLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </LinearLayout>
</ScrollView>

So I need to add images to this scrollview like this:

|-------------
|
|Image 1
|-------------
|
|Image 2
|-------------
|
|Image 3
|-------------

For this I need to change somehow content size of Scrollview ?

How this is done in Android ?

Thanks.

  • 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-02T14:46:52+00:00Added an answer on June 2, 2026 at 2:46 pm
    <LinearLayout
            android:id="@+id/filesScrollerLayout"
            android:orientation="vertical"     << this line
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </LinearLayout>
    
    
    LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);
    layout .addView(imageView);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to dynamically add Images to a ScrollView. Before adding I check if
I'm trying to add/change images in my project, using Microsoft Visual Studio 2008 C#.
I'm trying to add two images together using NumPy and PIL. The way I
I'm trying to add images to my models in my Django app. models.py class
Ok, I am trying to add one row of multiple images to a JPanel,
I am trying to add n image to a panel using Netbeans. I dragged
I am trying to add custom images into Drupal's calendar view by checking 'nid'
I'm trying to add images to my models in my Django app. models.py class
I'm using a function to add images to a site. These go into a
I am trying to add images that have been stored to a NSMutableArray. As

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.