>From the language of your question, I suspect you are already on the
right track.

Basically, you want to create a custom component, which you can then
use throughout your application.  Essentially, you just create a XML
component (any View component) that you can then include in your other
layout XML files by referencing a unique namespace you created.

Link: http://developer.android.com/guide/topics/ui/custom-components.html

Pseudo-code:

Custom Component: com.your.namespace.CustomComp.xml

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<TextView android:id="@+id/infotitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/infodata"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>

Including it in your layout:

<LinearLayout>...
<com.your.namespace.CustomComp android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>


On May 2, 2:22 pm, Nick <[email protected]> wrote:
> I have a top action bar in my application, similar to how the Twitter and
> Facebook apps have it set up.  In this bar, I have a search button which
> will do a search.  On click, I want it to start the search activity.  What's
> the best way to include this in my application?  Viewgroup?  Merge?  I don't
> want to have to re-write the code every single time.
>
> Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Discuss" 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-discuss?hl=en.

Reply via email to