问题
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