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?

asked Nov 8, 2012 at 22:30

loeschg's user avatar

No, AFAIK you will have to go with the full name.

answered Nov 8, 2012 at 22:46

Vincent Mimoun-Prat's user avatar

3 Comments

You were first, so if this is indeed the answer, I will mark it as such. :)

@Error454, thanks! I am indeed using that technique for custom attributes.

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.

answered May 13, 2013 at 13:45

Jules's user avatar

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.