Meriam
Meriam

Reputation: 955

Android: fixed button in each view

Is there a way to make a button fix in the whole application views? I mean instead of adding the button to every xml file and code it. Thank you.

Upvotes: 0

Views: 159

Answers (2)

blessanm86
blessanm86

Reputation: 31779

You can keep your button xml code a different xml file. And to every other activity xml layout you can use the xml tag include like

<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
    <include layout="@layout/okcancelbar_button"/>
</LinearLayout>

Or like jack said, create a base activity that creates the buttons and the rest of the activities can extend from it.

Upvotes: 2

Jayyrus
Jayyrus

Reputation: 13061

you can create a custom activity in which you create one time button and every activity you will call, extended to your custom activity will have that button

Upvotes: 0

Related Questions