Protecting android app against Tapjacking

I was reading up on the official documentation about protecting the app against Tapjacking and the solution provided is the following:

Full occlusion is prevented by setting View.setFilterTouchesWhenObscured(true) in the code. This blocks touches passed by an overlay. If you prefer a declarative approach, you can also add android:filterTouchesWhenObscured="true" in the layout file for the View object that you want to protect.

Is there a way to do that on a managed project (with EAS) or is this just achievable through native code?