0
我在一个应用程序中工作,我在底部有一个专用菜单,其中包含一些固定按钮,它们具有相同的功能,并且在所有活动中的行为相同。 我尝试在不同的活动中使用相同的按钮ID(视图)的ID,但它不工作。我也搜索了很多没有找到任何方式 是否有任何方式可以在多个活动中共享视图或视图组?例如,我创建此布局一次又一次使用相同的VIEW(Android)
<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>
是有任何方式,这种布局ID =“childLayout”可在其布局ID =内部“parentLayout”
谢谢,它真的帮了很多 – ammar26