Reputation: 1612
I working on an app where i have a dedicated menu at the bottom which contains some fixed buttons that have same function and behave in same way on all the activities. I tried using the same ID of Button(View) in different activities but it isn't working. Also i searched a lot didn't find any way Is there is any way that i can share a View or View Group in more then one activities ?
For example i create this layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parentLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/childLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" android:layout_weight="1" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button1" android:layout_weight="1"/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button2" android:layout_weight="1"/>
</LinearLayout></LinearLayout>
Is there is any way that this layout id ="childLayout" can be used in any other activity which is inside layout id = "parentLayout"
Upvotes: 0
Views: 184