I've looking for a way to declare a parameterized view with in a layout. For example if I have a class NumericTextView<T> extends TextView
I want to be able to declare it in an xml layout. The following doesn't seem like it will work because of the way the layout is parsed.
<NumbericTextView<Integer>/>
But could I potentially have something like this?
<NumbericTextView type:Integer/>
If that still won't work is there anything wrong with using some custom FrameLayout
that switches on a parameter to add the correct NumbericTextView<T>
child?
You'll want to do something like:
<com.my.ui.NumericTextView
android:id="@+id/MyTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
see android custom text view can not be added in layout file
and this for custom attributes: http://prasanta-paul.blogspot.com/2010/05/android-custom-textview.html