Home > Mobile >  Android databinding method parameter problem
Android databinding method parameter problem

Time:10-09

Call the custom class method controls, how to set itself to parameter passing in, such as the code below:

This is my custom class in two methods:
Public static String addColonString (int id) {
return "";
}
Public static String addColonString (TextView view, int id) {
return "";
}

To use this method in the XML
Android: layout_width="wrap_content"
Android: layout_height="wrap_content"
Android: ems="2"
Android: text="@ {Util. AddColonString (@ string/consume_type)}"
Android: textSize="@ dimen/sp_14"
Android: textColor="@ color/context_text_color"/& gt;


Now set parameters corresponding to only addColonString (int id)
So how to corresponding to the addColonString (TextView view, int id)

CodePudding user response:

Same, the original poster in finding a solution, the trouble to send me a, thank you very much! E-mail: 421294020 @qq.com

CodePudding user response:

The android: onClick="@ {(view) - & gt; Util. AddColonString (view, @ string/consume_type)}"
  • Related