I would like to do something like
<TextViewPlus
android:id="@+id/settings_title_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/settings />
instead of
<com.my.really.super.long.package.name.that.wont.autocomplete.TextViewPlus
android:id="@+id/settings_title_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/settings />
I figure I could just put custom Views in the (default) package, but that seems like a bad idea. (EDIT: And upon testing this, it doesn't work anyway) Is there a "good" way to do this?
LayoutInflater.setFactory(LayoutInflater.Factory) allows you to specify an object that performs custom view object creation given the tag name at run time. This could be used to achieve what you want to do. I'd call getFactory() first to retrieve the existing default factory object and use that for any view names that are not your custom views.
Comments
Explore related questions
See similar questions with these tags.
