Search in sources :

Example 1 with ViewStubBinding

use of com.liangfeizc.databinding.databinding.ViewStubBinding in project MasteringAndroidDataBinding by LyndonChin.

the class ViewStubActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_view_stub);
    mBinding.viewStub.setOnInflateListener(new ViewStub.OnInflateListener() {

        @Override
        public void onInflate(ViewStub stub, View inflated) {
            ViewStubBinding binding = DataBindingUtil.bind(inflated);
            User user = new User("liang", "fei");
            binding.setUser(user);
        }
    });
}
Also used : ViewStub(android.view.ViewStub) User(com.liangfeizc.databinding.model.User) View(android.view.View) ViewStubBinding(com.liangfeizc.databinding.databinding.ViewStubBinding) ActivityViewStubBinding(com.liangfeizc.databinding.databinding.ActivityViewStubBinding)

Aggregations

View (android.view.View)1 ViewStub (android.view.ViewStub)1 ActivityViewStubBinding (com.liangfeizc.databinding.databinding.ActivityViewStubBinding)1 ViewStubBinding (com.liangfeizc.databinding.databinding.ViewStubBinding)1 User (com.liangfeizc.databinding.model.User)1