java - Access custom XML attributes from root element -
I've enhanced ViewGroup and created a custom layout class in Android. I have defined to support a custom XML attributes that situation Sbwugh I do I need to get some custom XML attributes (custom: Wu_hait and custom: Drishy_vidth) at the root XML element (custom layout), but when I I try to access them from the Java class, typed. Array is empty, it does not seem to be able to see them. They work fine on child's thoughts, any witch How can I access custom XML properties in the form of a tar? Thanks!
Look at the code:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Package.of.my.CustomLayout xmlns: Android = "http://schemas.android.com/apk/res/android" xmlns: custom = "http://schemas.android.com/apk/res-auto" Android : Layout_height = "Match_parent" Android: Layout_width = "Match_parent" android: orientation = "vertical" android: background = "@ drawable / homecell_selector" custom: view_width = "400" // I need this !! Custom: view_height = "200" // I need it !! & Gt; & Lt; Button android: id = "@ + id / postText" Android: layout_marginLeft = "20dp" Android: layout_marginTop = "45dp" Android: Layout_height = "Wrap_content" Android: Layout_width = "Wrap_content" Android: alpha = "1" Android: Background = "@ color / HEX_FFFFFFFF" Android: Textcolor = "@ color / HEX_000" Android: TextSize = "L5sp" Android: visibility = "visible" android: gravity = "left" custom: view_width = ".87610022270753" custom: eHeight custom = "0.44296926842493" custom: eWidth = "true" custom: originX = "right" custom: x = "0.061399777292469" custom: eX = "true" custom: OriginY = "BOTTOM" custom: y = "0.168 2145166653 "Custom: eY =" true "/> & Lt; Android: layout = "id =" @ + id / firstNameLastNameShortText "Android: layout_marginLeft =" 21dp "Android: layout_marginTop =" 8dp "Android: layout_height =" 18dp "Android: layout_width =" 276dp "Android: Alpha =" 1 "Android: Background = "@ color / HEX_2087fc" Android: Textcolor = "@ color / HEX_000" Android: TextSize = "L5sp" Android: visibility = "visible" android: gravity = "left" custom: view_width = ".86433765030597" custom: EHeight = Custom: view_height = ".15716154473749" custom: eWidth = "true" custom: originX = "left" custom: x = ".065625" custom: prefix = "true" custom: ori GinY = "top" custom: y = "0.069849575438883" custom: eY = "true" /> & Lt; /package.of.my.CustomLayout>
Actually you do not need those people because you need width and height And whatever width and height you want to add to your custom view, you should add them directly to Android: layout_width and android: layout_height tag
Comments
Post a Comment