<span id="Label3"></p><p><p><span style="font-size: 15px;"></span></p></p><p><p><span style="font-size: 15px;"><strong>First Step: customizing XML properties</strong></span></p></p><p><p><span style="font-size: 15px;">Create a new Android project, create a new Atts.xml file in the values folder, and declare in this XML file the properties we will need to specify when using the custom Control.</span><br><span style="font-size: 15px;">Atts.xml</span></p></p><pre><span style="font-size: 15px;"><code class="hljs xml"><span class="hljs-pi"><?xml version= "1.0" encoding= "utf-8"?><span class="hljs-tag"><<span class="hljs-title">Resources><span class="hljs-tag"><<span class="hljs-title">Declare-styleable<span class="hljs-attribute">Name=<span class="hljs-value">"ToolBar" ><span class="hljs-tag"><<span class="hljs-title">attr<span class="hljs-attribute">Name=<span class="hljs-value">"title"<span class="hljs-attribute">format=<span class="hljs-value">"string"/><span class="hljs-tag"><<span class="hljs-title">attr<span class="hljs-attribute">Name=<span class="hljs-value">"titletextsize"<span class="hljs-attribute">format=<span class="hljs-value">"dimension"/><span class="hljs-tag"><<span class="hljs-title">attr<span class="hljs-attribute">Name=<span class="hljs-value">"titletextcolor"<span class="hljs-attribute">format=<span class="hljs-value">"color"/><span class="hljs-tag"><<span class="hljs-title">attr<span class="hljs-attribute">Name=<span class="hljs-value">"leftbackground"<span class="hljs-attribute">format=<span class="hljs-value">"reference|color"/><span class="hljs-tag"><<span class="hljs-title">attr<span class="hljs-attribute">Name=<span class="hljs-value">"lefttext"<span class="hljs-attribute">format=<span class="hljs-value">"string"/><span class="hljs-tag"><<span class="hljs-title">attr<span class="hljs-attribute">Name=<span class="hljs-value">"lefttextcolor"<span class="hljs-attribute">format=<span class="hljs-value"><span class="hljs-value"> "reference|color"/> <span class="hljs-tag"><<span class="hljs-title">attr <span class="hljs-attribute">name=<span class="hljs-value"> "rightbackground" <span class="hljs-attribute">format=< Span class= "hljs-value" > "reference|color"/> <span class="hljs-tag"><<span class="hljs-title">attr <span class="hljs-attribute">name=<span class="hljs-value"> "righttext" <span class="hljs-attribute">format=<span class="hljs-value"> "string"/> <span class="hljs-tag"><<span class="hljs-title">attr <span class="hljs-attribute">name=<span class="hljs-value"> "righttextcolor" <span class="hljs-attribute">format =<span class="hljs-value"> "reference|color"/> <span class="hljs-tag"></<span class="hljs-title"> Declare-styleable><span class="hljs-tag"></<span class="hljs-title">resources> </span> </span> </span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></code></span></pre><p><p><span style="font-size: 15px;">The previous name is the name of the property we want to use, followed by format, which indicates that the property accepts a value that is a string, that the value of the property is a color value, and that dimension indicates that the value of the property is a dimension, Reference indicates that the value of this property can refer to a resource id, and other common format values are: boolean (boolean), float (floating point value), integer (integer value), fraction (percent), enum (enumeration value), Flag (bit or operation).</span></p></p>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service