Android Custom Button Drawable XML File

♀尐吖头ヾ 提交于 2020-01-05 04:18:09

问题


I recently discovered that you can describe an Android custom drawable in an XML file, which you can then use with a button (and other View, I guess), and this inspired me to ask this question:

Does anyone know (or know where I can find) an XML file that precisely describes the exact default button that shows up in an Android application if you don't change a single detail.

It seems to me, that would be a very helpful starting point.

Thanks, R.


回答1:


The default Android Views, like Button, and its selector XML files are available in resource folder of particular Android platform.

For example, \android-sdk-windows\platforms\android-8\data\res\drawable folders.

These drawables and XML files are accessible in our application code, using 'android.R'. For example: android.R.drawable.btn_check




回答2:


//this is an nice tutor for gradient

This time, all those gradients are created programmatically which gives you total control of the button and the gradient!

link here:



来源:https://stackoverflow.com/questions/9668087/android-custom-button-drawable-xml-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!