view binding in android
android {
...
//in build.gradle(app level)
buildFeatures {
viewBinding true
}
}
view binding in android
android {
...
//in build.gradle(app level)
buildFeatures {
viewBinding true
}
}
view binding in android studio
<LinearLayout
...
tools:viewBindingIgnore="true" >
...
</LinearLayout>
use view binding in fragment
private FragmentJavaPracticeBinding binding;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = FragmentJavaPracticeBinding.inflate(inflater,container,false);
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
binding.notesRecyclerView.setVisibility(View.VISIBLE);//this hide/show recyclerview visibility
Log.d("TAG", "hidden: ");
}
How to use view binding in android studio
// Android Studio 4.0android { buildFeatures { viewBinding = true }}
view binding in android
android{
...
//for android gradle plugin 3.6 or lower
viewBinding{
enabled true
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us