If there is a layout you want to include that has a lot of components, it
can be easier to make a View class for that layout and simply use that
class in your layouts. The easier approach to this is to extend and
existing ViewGroup class and simply inflate your desired layout in the
constructor. You can also add your own methods and variables to the class
to make it easier to handle behavior that view is supposed to support. Then
in xml you can simply do
<com.my.package.MyView
android:id="@+id/MyActivity_myView1"
... />
If the layout is simple, that approach might be overkill, so <include>
could be better.
On Tuesday, January 29, 2013 9:19:42 PM UTC-5, dashman wrote:
>
> I'd like to use INCLUDE layouts on 2 separate layouts.
>
> But how do I refer to controls by id that's inside the included
> layout.
>
> e.g. INCLUDED layout.xml
>
> <textview id="@+id/textView1/>
> <textview id="@+id/textView2/>
>
>
> and in the container layout
>
>
> <include id="@+id/container" layout="layout"/>
>
>
>
>
>
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.