Android Custom Controls (iii) Add content custom properties format details
Last Update:2015-06-13
Source: Internet
Author: User
<span id="Label3"></p><p><p>Transfer from http://www.gisall.com/html/35/160435-5369.html</p></p><p><p>1. reference: refer to a resource ID.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name = "names" ></p></p><p><p><attr name = "background" format = "reference"/></p></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><imageview</p></p><p><p>Android:layout_width = "42dip"<br>Android:layout_height = "42dip"<br>Android:background = "@drawable/picture id"</p></p><p><p>/></p></p><p><p>2. Color: colour Value.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name = "names" ></p></p><p><p><attr name = "textcolor" format = "color"/></p></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><textview</p></p><p><p>Android:layout_width = "42dip"<br>Android:layout_height = "42dip"<br>Android:textcolor = "#00FF00"</p></p><p><p>/></p></p><p><p>3. Boolean: Boolean Value.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name = "names" ></p></p><p><p><attr name = "focusable" format = "boolean"/></p></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><button</p></p><p><p>Android:layout_width = "42dip"<br>Android:layout_height = "42dip"</p></p><p><p>Android:focusable = "true"</p></p><p><p>/></p></p><p><p>4. Dimension: Dimension Value.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name = "names" ></p></p><p><p><attr name = "layout_width" format = "dimension"/></p></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><button</p></p><p><p>Android:layout_width = "42dip"<br>Android:layout_height = "42dip"</p></p><p><p>/></p></p><p><p>5. Float: Floating-point Value.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name = "alphaanimation" ></p></p><p><p><attr name = "fromalpha" format = "float"/><br><attr name = "toalpha" format = "float"/></p></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><alpha<br>Android:fromalpha = "1.0"<br>Android:toalpha = "0.7"</p></p><p><p>/></p></p><p><p>6. Integer: Integer Value.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name = "animatedrotatedrawable" ></p></p><p><p> <attr name = "visible"/> <br> <attr name = "frameduration" format= "integer"/> <br> <attr name = " Framescount "format=" integer "/> <br> <attr name = "pivotx"/> <br> <attr name = "pivoty"/> <br> <attr name = " drawable "/> </p></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><animated-rotate</p></p><p><p> xmlns:android = "http://schemas.android.com/apk/res/android" <br> android:drawable = "@drawable/picture ID " <br> Android:pivotx = "50%" <br> Android:pivoty = "50%" <br> android:framescount = " "; <br> android:frameduration = "+" </p></p><p><p>/></p></p><p><p>7. String: Strings.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name = "mapview" ><br><attr name = "apiKey" format = "string"/><br></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><com.google.android.maps.mapview<br>Android:layout_width = "fill_parent"<br>Android:layout_height = "fill_parent"<br>Android:apikey = "0jokq80od1jl9c6haja99ugxcris2cgjko_bc_g"</p></p><p><p>/></p></p><p><p>8. Fraction: Percentage.</p></p><p><p>(1) attribute Definition:</p></p><p><declare-styleable name= "rotatedrawable" ><br><attr name = "visible"/><br><attr name = "fromdegrees" format = "float"/><br><attr name = "todegrees" format = "float"/><br><attr name = "pivotx" format = "fraction"/><br><attr name = "pivoty" format = "fraction"/><br><attr name = "drawable"/><br></declare-styleable></p><p><p>(2) attribute Use:</p></p><p><p><rotate</p></p><p><p>Xmlns:android = "http://schemas.android.com/apk/res/android"<br>Android:interpolator = "@anim/animation id"</p></p><p><p>Android:fromdegrees = "0"<br>Android:todegrees = "360"</p></p><p><p>Android:pivotx = "200%"</p></p><p><p>Android:pivoty = "300%"<br>Android:duration = "5000"</p></p><p><p>Android:repeatmode = "restart"</p></p><p><p>Android:repeatcount = "infinite"</p></p><p><p>/></p></p><p><p>9. Enum: Enumeration Value.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name= "name" ><br><attr name= "orientation" ><br><enum name= "horizontal" value= "0"/><br><enum name= "vertical" value= "1"/><br></attr></p></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><linearlayout</p></p><p><p>Xmlns:android = "http://schemas.android.com/apk/res/android"<br>Android:orientation = "vertical"<br>Android:layout_width = "fill_parent"<br>Android:layout_height = "fill_parent"<br>><br></LinearLayout></p></p><p><p>Flag: bit or Operation.</p></p><p><p>(1) attribute Definition:</p></p><p><declare-styleable name= "name" ><br><attr name= "windowsoftinputmode" ><br><flag name = "stateunspecified" Value = "0"/><br><flag name = "stateunchanged" Value = "1"/><br><flag name = "statehidden" Value = "2"/><br><flag name = "statealwayshidden" Value = "3"/><br><flag name = "statevisible" Value = "4"/><br><flag name = "statealwaysvisible" Value = "5"/><br><flag name = "adjustunspecified" Value = "0x00"/><br><flag name = "adjustresize" Value = "0x10"/><br><flag name = "adjustpan" Value = "0x20"/><br><flag name = "adjustnothing" Value = "0x30"/><br></attr></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><activity</p></p><p>Android:name = ". Styleandthemeactivity "<br>Android:label = "@string/app_name"<br>Android:windowsoftinputmode = "stateunspecified | stateunchanged | Statehidden "><br><intent-filter><br><action Android:name = "android.intent.action.MAIN"/><br><category Android:name = "android.intent.category.LAUNCHER"/><br></intent-filter><br></activity></p><p><p>Attention:</p></p><p><p>Multiple types of values can be specified when the property is Defined.</p></p><p><p>(1) attribute Definition:</p></p><p><p><declare-styleable name = "names" ></p></p><p><p><attr name = "background" format = "reference|color"/></p></p><p><p></declare-styleable></p></p><p><p>(2) attribute Use:</p></p><p><p><imageview</p></p><p><p>Android:layout_width = "42dip"<br>Android:layout_height = "42dip"<br>Android:background = "@drawable/picture id| #00FF00"</p></p><p><p>/></p></p><p><p>Android Custom Controls (iii) Add content custom properties format details</p></p></span>