Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating elegant buttons

Tags:

android

How do I create or download elegant/stylish buttons (Widgets) instead of using the simple buttons ?

like image 593
Pa1 Avatar asked Feb 26 '23 07:02

Pa1


1 Answers

If you want to make a legitimate, fully-implemented button skin, you make a state-list 9-patch drawable.

A 9-patch drawable is a standard drawable with sections that can be repeated; for instance, the top-left, top-center, top-right, middle-left and so on portions of a button.

(You can read in-depth here: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch)

A state-list drawable is a drawable which changes its resource according to a particular state. In the case of a button normal, highlighted, and pressed are the states.

http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

So you pretty much need to make three nine-patch drawables and a state-list drawable to hook up these three nine-patches.

A few other ways you could do it:

  • Subclass a View and build your own button from the ground up.
  • Someone else mentioned an ImageButton
like image 67
OEP Avatar answered Mar 06 '23 16:03

OEP