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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:51:36+00:00 2026-05-26T20:51:36+00:00

In my activity i am creating a Imageview dynamically. Every time it fetch the

  • 0

In my activity i am creating a Imageview dynamically. Every time it fetch the image from server create an imageview and set that image.

All images size also not same , so i want to put all images in a particular size.
But its not working. Here is my code bellow,

        ImageView imageView = new ImageView(getActivity());
        imageView.setImageResource(mContent);
        imageView.setPadding(20, 20, 20, 20);

                    imageView.setMaxWidth(400);
        imageView.setMaxHeight(400);

        LinearLayout layout = new LinearLayout(getActivity());
        layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        layout.setGravity(Gravity.CENTER);
        layout.addView(imageView);
  • 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-26T20:51:37+00:00Added an answer on May 26, 2026 at 8:51 pm

    Simply do this,

        imageview.getLayoutParams().height=100;
                imageview.getLayoutParams().width=100;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query in my android app that pulls all image paths from
I am creating a TextView dynamically from Activity. I created 2 Textviews and I
I have an activity that has a TabHost containing a set of TabSpecs each
I'm creating android app that has table layout for the main activity, and that
long time listener, first time caller... I am creating a splash screen derived from
I'm creating an app that creates buttons through code when an activity starts (the
Im creating a View object and set it as the content view on activity.
I'm creating a widget where the user in the configuration activity can select from
i'm creating an activity which needs to upload an image to a webservice using
My activity needs to communicate with a java server located on my dev machine.

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.