android - How do I set the rounded corner radius of a color drawable using xml? -


On the Android website, there is one. Defining these designs in XML looks like this:

  & lt; Resources & gt; & Lt; Dry name = "solid_read" & gt; # F00 & lt; / Drawable & gt; & Lt; Dryable name = "solid_blue" & gt; # 0000ff & lt; / Drawable & gt; & Lt; Dryable name = "solid_green" & gt; # F0f0 & lt; / Drawable & gt; & Lt; / Resources & gt;  

In the Java APIs, they do the following methods to define the spherical corners:

  setCornerRadius (float radius)  

Is there a way to set the spherical corners in xml?

Use & lt; To make a drawable in XML with rounded corners; Size & gt; Tags (You can also do other things with the shape tag, like defining color gradients as well).

Here's a copy of an XML file that I am using in one of my applications to create drawables with a white background, black border and spherical corners:

  & Lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Size xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Solid Android: Color = "#FFFFFF" /> & Lt; Stroke Android: width = "3dp" Android: color = "# ff000000" /> & Lt; Padding android: left = "1dp" android: top = "1dp" Android: right = "1dp" Android: Below = "1dp" /> & Lt; Corne's Android: Right below: Rolandius = "7dp" Android: Floor Lift-Radius = "7dp" Android: topLeftRadius = "7dp" Android: topRightRadius = "7dp" /> & Lt; / Size & gt;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -