ajb468 wrote:
> I've seen several examples on the internet on how to go from setting
> your layout all the way to setting the TextView but I've only seen all
> of this done in the Activity class. For example, to set the text of
> the TextView, I've seen:
> 
> TextView tv = new TextView(this);
> tv.setText("This is a text view");
> 
> but is it possible to set the text(and all the others features you can
> of a TextView) in your class that extends TextView and then use that
> class in the activity?
> For example:
> 
> public class myTextView extends TextView{
> 
> // Set everything you need to for this text view in the class itself.
> // Set the text as "
> }
> 
> and then in the Activty simply add myTextView into a linear layout and
> have everything ready without having to do:
> 
> myTextView mtv = new myTextView(this);
> mtv.setText("this is my text view");
> mtv.set....

Yes, though I would never recommend this technique.

You are hopefully setting up your TextView properties in layout XML. If
you have several TextViews sharing common properties, you can address
that with styles and themes.

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

_Beginning Android 2_ from Apress Now Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe from this group, send email to 
android-beginners+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to