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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:25:05+00:00 2026-06-05T15:25:05+00:00

I want to use a command like this: ImageView image = (ImageView) findViewById(R.id.x2); where

  • 0

I want to use a command like this:

ImageView image = (ImageView) findViewById(R.id.x2);

where should I put in the file main.xml the following piece of code?

<ImageView 
    android:id="@+id/x2"
    android:src="@drawable/book"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
  • 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-05T15:25:05+00:00Added an answer on June 5, 2026 at 3:25 pm

    Dheeresh Singh is ok.
    main.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    
       <ImageView 
              android:id="@+id/x2"
              android:src="@drawable/book"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" />
    </LinearLayout>
    

    If you want to position the image in a different place, you can modify different attributes

     <ImageView 
                  android:id="@+id/x2"
                  android:src="@drawable/book"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="42dp"  <!--for example  -->
                  android:layout_marginLeft="25dp"
                  android:layout_marginRight="25dp" 
                  android:layout_marginTop="25dp"/>
    

    For more information about this, look at the android tutorials

    http://developer.android.com/reference/android/widget/ImageView.html (for ImageView attributes)
    http://developer.android.com/resources/tutorials/views/index.html (for view info)

    Excuse me for my english.
    Good Luck!

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

Sidebar

Related Questions

I want a command line option like this one in the following KornShell (ksh)
I want to use the following command: openssl x509 -noout -in /etc/pki/tls/certs/cert1.pem -enddate openssl
When i want to populate my grid I use this Select command : SELECT
I want to use the like command in a query to find specific results
I want to use a exe file (convert.exe), inside my C++ program. This exe
I want to use the exec:java plugin to invoke the main class from command
I am setting a variable, and then I want to use the USE command
I want to use rails genrate command in gem development. Is it possible?
i want to update all records in my database(mongodb),I tried to use command below
I want to use ADO.NET Prepare command will increase performance if query is repeatevely

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.