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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:23:04+00:00 2026-06-05T17:23:04+00:00

I need a circle object as follows : The name and count extracts info

  • 0

I need a circle object as follows :
circle

The name and count extracts info from a DB and displays it for each circle.
The circle needs to be clickable so I’m thinking of extending the Button class.

What do I do in the onDraw and onMeasure methods to create this? Also once created, how do I use this class? How can I call this component to be displayed in my screen with other component views?

EDIT: I have read many posts and some tutorials and none have been too helpful for “customized views”

  • 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-05T17:23:06+00:00Added an answer on June 5, 2026 at 5:23 pm

    You don’t need extend the button class to do this.

    If I were you I probably wouldn’t even make a custom View, I would use a LinearLayout with 2 TextViews in it. And the background on the linear layout I would set to a png of the circle.

    something like this would be the xml;

    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/circle"
    android:orientation="vertical"
    android:id="@+id/circleLyt">
    
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/nameTxt"
     />
    
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/countTxt"
     />
    
    </LinearLayout>
    

    Make sure to put circle.png into your drawable folder.
    You can gain references to all of these Views with findViewById(); So once you have references to the TextViews you can set the text to whatever you need. And with the LinearLayout reference you can set a click listener on it the exact same way as you would for a Button.

    something like this would work:

    mCircleView = (LinearLayout)findViewById(R.id.circleLyt);
    mCircleView.setOnClickListener(new OnClickListener() {
        public void onClick(View v){
            //do some stuff!
        }
    }); 
    

    You could even make this layout as its own xml file and use an Adapter to be able to fill some other structure with these circles like a GridView perhaps. You’d just need to inflate the Views and populate the text inside your Adapters getView() method.

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

Sidebar

Related Questions

I need to draw a circle onto a bitmap in a specific colour given
I need to draw a rectange,circle and line and then animate them(press left ->
I want to create custom button and I need it to be circle. How
I have two curves, one inside another, for example ellipse inside circle. I need
i need to animate an object in c# windows application int l_nCircleXpos = 9,
In my project I am using a custom circle-shaped button widget derived from the
I need to have all point coordinates for a given circle one after another,
I need draw rectangle with two circle holes inside. The problem is in circles
I'm having trouble with something, I need to make an object (Pong paddle) to
I need to create a circle of regularly spaced doors around a reference point

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.