Android - Can I Databinding programatically? - without layout XML
问题 Below is XML equivalent of what I'm trying to achieve, but without XML <Button android:id="@+id/bt_start" android:onClick="@{() -> vm.onClickedStart()}" android:text='@{vm.btStartLbl}' /> so if I have: ConstraintLayout cl = findViewById(R.id.cl); Button btn = new Button(MyActivity.this); btn.setText("How to Data Bind here?"); btn.setOnClickListener(new OnClickListener (){ /* how to databind here? */ }); cl.addView(btn); how to databind it as equivalent as xml above? is it possible? 回答1: For