Rud wrote:
> I vaguely recall seeing the use of a custom view class in the layout
> XML that was something like:
> 
>       <us.k5rud.experiment.ExpView __something__ View
>                                 android:id="@+id/expView"
>               android:layout_width="wrap_content"
> android:layout_height="wrap_content"
>               android:layout_toRightOf="@+id/TextView01">
> 
> where _something_ was like the Java "extends" View. It was an
> indicator that the custom view was a subclass of an existing View.
> 
> Is my memory wrong or just garbage collected?

Well, what you wrote there wouldn't be valid XML, so I think your memory
is combining two halves of the problem into one. Kinda like how a
Reese's Peanut Butter Cup combines chocolate and peanut butter into a
delicious whole.

(mmmmmmmmmmmmmmmmmmmmmmmm...Reese's!)

Drooling aside, your Java class declaration for a custom View may well
look like:

package us.k5rud.experiment;

public class ExpView extends View {
        // lots of good peanut butter here
}

You would use that View in layout XML through an element with the full
namespace declaration, since your View isn't in android.widget:

<us.k5rud.experiment.ExpView
        android:id="@+id/expView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/TextView01"
        android:chocolate="num_num_num"
/>

(In the interests of full disclosure, I have no affiliation with the
manufacturers of Reese's Peanut Butter Cups, other than living about two
hours east of Hershey, PA. And, um, needing to drop a few pounds.)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.0 Available!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to