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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:04:54+00:00 2026-06-07T09:04:54+00:00

I have an ImageView, and on a click I want to replace its image

  • 0

I have an ImageView, and on a click I want to replace its image with a bigger one, but there seems to be a problem. The image stretches downwards but it should extend upwards. I have tried to do it dynamically as well via XML, but it’s not working.

// addnews button on the first screen
final ImageView addnewsback = (ImageView)findViewById(R.id.newslistback);
ImageView addnews = (ImageView)findViewById(R.id.newslistbtn);
addnews.setOnClickListener(new OnClickListener() {
    public void onClick(View arg0) {
        addnewsback.setImageResource(R.drawable.bgbig);
    vf.setDisplayedChild(0);
    }
});

Enter image description here

<RelativeLayout
    android:id="@+id/c1"
    android:layout_marginTop="0dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_alignParentLeft="true">

    <ImageView
        android:id="@+id/newslistback"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/holderview"
        android:src="@drawable/bg" />

    <ImageView
        android:id="@+id/newslistbtn"
    android:layout_marginLeft="14dp"
    android:scaleType="fitXY"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/newslisticon" />

</RelativeLayout>
  • 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-07T09:04:56+00:00Added an answer on June 7, 2026 at 9:04 am

    Try to use relativelayout with background images as its own background and not new imageview it would reduce the clutter and dont try to give then a size and use appropriate graphic size.

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

Sidebar

Related Questions

I have listview having customized some textview and one imageview. When I long click
i have a grid view which contain images when click on one image it
I have an imageview that moves up when i click a button. i want
i have a ImageView in the layout, when i click on the image i
I have RelativeLayout with ImageView. I want to click on the picture and add
I have an ImageView in my xml file, i want to rotate the image
In my view i have ImageView.If i click ,it should open nextview. Please help
I have an ImageView and TextView . I want to place the TextView below
I have a gridview in which there are two elements in each of its
I have one listview.which contain one image ,text and one button .i had creted

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.