Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

another way for style implement #132

Closed
@BennyWang

Description

@BennyWang

Now apply style in Anko will go through all the children, if I want to apply more than one style, It will loop several time, I know I can combine style to one function, but It will make the function to big.
so I thought one way for style implement like this.

verticalLayout {
    style<TextView> {   //no name style, apply to all the TextView
        textSize = xxxx
        textColor = xxxxx
    }
    style<TextView>("style1") {   //named style, apply to the TextView with style = "style1"
        textSize = xxxx
        textColor = xxxxx
    }
    editText {
        style = "style1"  //only apply style1 and no name style
    }.lparams(width = matchParent)

    view { 
        backgroundResource = R.color.color_f2 
    }.lparams(width = matchParent, height = 1)

    editText { // will only apply no name style
    }
}

I think this is possible by using view.tag

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions