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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:17:38+00:00 2026-06-14T15:17:38+00:00

I am currently writing a custom ImageView. what im actually turning this imageview into

  • 0

I am currently writing a custom ImageView. what im actually turning this imageview into is a multiple state button.

In my case, the button has three states, answered with yes, answered with no and unanswered.
I strictly don’t want to use a radiogroup/button.

I have the basic setup for the imageview. It has onclick functionality to properly change the image depending on the state. Which for now is just a checkbox with a cross, an empty checkbox and a checkbox with a tick.

What I want is, when the state changes(the image is clicked) i want text, which should Always be around, and never ontop of the imageview. To change its value aswell. I want to be able to call a method similar to customCompInstance.getText(); customCompInstance.getText();

What im thinking is, the custom imageview class should have a TextView member, but I have NO clue whatsoever how to place it on the left, horizontally aligned to the imageview.

It is NOT an option to just use two different elements in xml.

Is adding a textview and placing it to the right of the imageview the right solution, if not, what do you suggest, if so, please give me some tips on how to actually achieve this.

Simplified version of my class:

public class AnswerImageView extends ImageView {
    private AnswerState mSelectionState;

    /**
     * @param context
     */
    public AnswerImageView(Context context)
    {
        super(context);
        // TODO Auto-generated constructor stub
        setImageResource(R.drawable.answer_none);
        setTag(R.drawable.answer_none);
        mSelectionState = AnswerState.ANSWER_NONE;
    }

    /**
     * @param context
     * @param attrs
     */
    public AnswerImageView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        // TODO Auto-generated constructor stub
        setImageResource(R.drawable.answer_none);
        setTag(R.drawable.answer_none);
        mSelectionState = AnswerState.ANSWER_NONE;
    }

    /**
     * @param context
     * @param attrs
     * @param defStyle
     */
    public AnswerImageView(Context context, AttributeSet attrs, int defStyle)
    {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
        setImageResource(R.drawable.answer_none);
        setTag(R.drawable.answer_none);
        mSelectionState = AnswerState.ANSWER_NONE;
    }

    public AnswerState getSelectionState() {
        return mSelectionState;
    }

    public void setSelectionState(AnswerState selectionState) {
        this.mSelectionState = selectionState;
    }
}

I have a method that reacts to onclicks, that all works fine. im purely asking about adding a textview in this component. Essentially combinding two components into one.

  • 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-14T15:17:39+00:00Added an answer on June 14, 2026 at 3:17 pm

    You should extend from TextView instead of ImageView and have a look at methods TextView.setCompoundDrawableXXX. Here is the link for the doc.

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

Sidebar

Related Questions

I'm currently writing DataTemplate for my custom type lets say FootballPlayer. In this template
I'm currently writing an custom control which has to hold child control and have
I am currently writing a small custom memory Allocator in C++, and want to
I am currently writing a simple IOS app that saves tasks into a table.
I'm currently writing a program in c# wpf with a custom window. So because
I'm writing a custom form UI and currently building a select box replacement. The
I am writing a custom tool and I currently have it doing what I
I'm currently writing a custom-designed tab control. I created my own control instead of
I am currently writing a few custom template tags but for some reason they
I'm currently writing a quick custom encoding method where I take a stamp a

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.