开发者

Creating elegant buttons

How do I create or download elegant/stylish buttons (Widgets) instead of using the simple bu开发者_运维百科ttons ?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜