Open aberba opened 6 years ago
DlangUI uses nine patch drawables like in android:
https://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
There's some css support it's just not fully implemented yet.
Borders (without border radius yet), box shadows, linear gradients. They are not yet documented anywhere, maybe I'll find a time to write about it on wiki.
By the way, you can type padding="2pt"
instead of padding="2pt,2pt,2pt,2pt"
and same with margins, border etc.
@dayllenger thanks very much. See
<style id="MAIN_MENU"
backgroundImageId="#linear,30deg,#bdf,#fff"
/>
I thought backgroundImageId
is used to reference images. Does it also support gradients as well?
Also, where can I find the implementation of supported styles not documented so I can utilize whilst waiting for it to be documented?
@triplejam how does the CSS implementation work?
backgroundImageId
is used similarly to CSS background
e.g. background: linear-gradient(-90deg, #f00, #ff0);
Styles implementation is quite spreaded. You can look at supported properties here, entire Style class or at some drawable classes starting here.
@aberba I don't really know to be honest. I just know there is some implementation in core/css.d and core/cssparser.d and they just have a unittest. It will be easier to just use the xml. There are some graphical tools like TreeLine which make it easier for editing xml files. If you try TreeLine use the "export" option for saving the theme.
Can someone please explain to me what these XML file in themes do. Exmaple switch.xml
has the content:
<selector>
<item android:state_checked="false" android:state_enabled="true" android:drawable="@drawable/switch_off"/>
<item android:state_checked="true" android:state_enabled="true" android:drawable="@drawable/switch_on"/>
<item android:state_checked="false" android:drawable="@drawable/switch_off_disabled"/>
<item android:state_checked="true" android:drawable="@drawable/switch_on_disabled"/>
</selector>
What's the meaning of the android:state_*
attributes and what do they do?
How are they loaded as part of the theme?
@aberba This file choose a drawable (graphics) for widget based on state for example enabled, disabled, pressed, hover etc.
OH ok. Will test my own version and see
But it doesn't work. Is such things supported? Where can I find the list of supported properties for each widgets?
The images used in theming are hard to tract since they are not organized into folders based on widget using it or some criteria.
Using XML is not only less productive, but also hard to keep tract of XML
attributes
andvalue
style of setting properties. Its much easiest to theme with a CSS syntax.. CSS is designed with that syntax for styling. Like GTK+ does [1][2] [1] https://developer.gnome.org/gtk3/stable/chap-css-overview.html [2] https://developer.gnome.org/gtk3/stable/chap-css-properties.html