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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:40:52+00:00 2026-05-13T15:40:52+00:00

I want to create a custom view (extends View) which contains an image and

  • 0

I want to create a custom view (extends View) which contains an image and a text.

Is it possible to set an listener just for image if i use canvas.drawBitmap(imageBitmap, ...) method?

Thank you!

  • 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-13T15:40:53+00:00Added an answer on May 13, 2026 at 3:40 pm

    If you want your view just to show an image and a text, why not create a specific layout in your XML file and use setContentView to display the view?

    If thats what you were looking for, I think that is the easiest approach. XML example coming soon.

    Here is the contents of my personal view to display my main application, just to demonstrate how I can switch view’s, your view would be different including a TextView and an ImageView.

    dblist.xml inside of res/layout folder.

    <?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"
       android:background="#FFFFFF">
    <ListView android:id="@+id/list"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:textColor="#000000"/>
    </LinearLayout>
    

    This contents display my database results onto a Spinner

    I can call that view by using:

    setContentView(R.layout.dblist);
    

    And if I want to return to my main layout, I can switch the view by calling

    setContentView(R.layout.main);
    

    EDIT:

    You can manipulate the view you are working with programmatically by using findViewById method. Let’s use my dblist.xml file as an example, notice that my ListView has an id of list. So I would call:

    ListView myList = (ListView) findViewById(R.id.list);
    

    With corresponds to that layout, so whenever I want to change anything to my XML file, I would reference myList use methods and callbacks to meet my needs.

    I hope this helps.

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

Sidebar

Related Questions

No related questions found

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.