user2007386
user2007386

Reputation: 1

using same buttons many times

I have 3 buttons that is modify ,view, clear and i want it to be used in 20 activities. I want to re use the same as if in user control in android? Button 1- Modify, Button 2 - Clear, Button 3- view. Is it good to make common view for all?

Upvotes: 0

Views: 54

Answers (1)

user1969053
user1969053

Reputation: 1760

You can keep your 3 buttons in another layout say layout_button.xml and then include this in ur activity's layout wherever required like : For ex. this ur activty layout :

<?xml version="1.0" encoding="utf-8"?>

 <-- Inflate your other elemnts of ur activity -->

<include
    android:layout_width="fill_parent"
    android:layout_x="0dp"
    android:layout_y="0dp"
    layout="@layout/layout_button" />

Upvotes: 2

Related Questions