How to create a custom button shape class

I wonder if this is simple. I want to create a new button class - which is basically just a normal button with rounded corners. The reason for this is that I want to be able to programmatically change the background colour of the button to anything using...

mybutton.setBackgroundColor(Color.parsecolor(somehexvalue));

without the button losing its shape (i.e. reverting to a rectangle).

I have created my button class and understand I need to overwrite the OnDraw method but don;t really understand how I then apply a custom shape at this point. Is this...

Read More »

By: StackOverFlow - 7 days ago

Related Posts

  • Older News
  • .setBackgroundResource(0) crashing my app StackOverFlow (Today) - In app, I allocate resources to button in GridLayout.if(fill[tappedButtonLocation] == 2 && !gameOver) {fill[tappedButtonLocation] = activePlayer;if (activePlayer == 0) {tappedButton.setBackgroundResource(R.drawable.circle_yellow);activePlayer = 1;} else {tappedButton.setBackgroundResource(R.drawable.circle_yelp);activePlayer = 0;}}Then I want to remove...
  • How do I do subtract from and add to a clip, instead of intersecting StackOverFlow (3 days ago) - So, I'm in java trying to draw pretty circles that overlap and sometimes I want them to stop at the boundary of another circle: previously I've been cleverly drawing over...