I want to create a new xml parameter for one of my custom views to handle the visibility of something within it. I can do it other ways of course, but I would like to do it in a way that I can use normal android params to change it.
something like:
<MyCustomView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:my_custom_visibility="gone"/>
so I coulg just do
viewToBeHidden.visibility = a.getInt(R.styleable.my_custom_view_my_custom_visibility, View.Visible);
I tried because visibilities are integers but it doesn't let me put gone in the view declaration
<attr name="my_custom_visibility" format="integer" />
using
<attr name="my_custom_visibility" format="reference" />
results in a compilation error:
AAPT: error: 'gone' is incompatible with attribute my_custom_visibility (attr) reference [weak].
the other types available for the attribute don't seem to apply to this case.
is there a way to achieve this?