Peter, can you try adding an id for the TextView (e.g. android:id="@
+id/txt1") in xml

After that in your Java code, you should be able to get the textview
by calling findViewById(R.id.txt1)

On Apr 8, 4:37 pm, peter <[EMAIL PROTECTED]> wrote:
> oops, I typed out the TextView definitions by hand so there is an
> error with the last line, should be:
>  android:text="text" />
>
> but that is somewhat irrelevant. Please ignore similar parse errors if
> any.
>
> Thanks again for your help,
> Peter
>
> On Apr 8, 4:34 pm, peter <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > I am having problems defining a custom view, any help would be
> > appreciated.
>
> > I would like to create a custom view that contains and manipulates
> > several standard TextViews.
>
> > I would like to be able to define this in XML as follows (so that I
> > don't have to add each TextView "by hand"):
>
> > <view class="com.mystuff.MyView"
> >         android:layout_width="fill_parent"
> >         android:layout_height="fill_parent"
> >         app:custom_attr1="attribute1"
> >         app:custom_attr2="attribute2"
> >         app:custom_attr3="attribute3">
>
> > <TextView
> >         android:layout_width="fill_parent"
> >         android:layout_height="fill_parent"
> >         android:text="text: />
> > <TextView
> >         android:layout_width="fill_parent"
> >         android:layout_height="fill_parent"
> >         android:text="text: />
> > <TextView
> >         android:layout_width="fill_parent"
> >         android:layout_height="fill_parent"
> >         android:text="text: />
>
> > </view>
>
> > I can obtain custom_attr1, 2, and 3 from StyledAttributes, but have no
> > idea how to obtain the TextViews from within the code of MyView
>
> > Is there a straight forward way to do this?
>
> > Thanks for your help,
> > Peter- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to