Java 包含问题的Android重用布局

Java 包含问题的Android重用布局,java,android,android-layout,user-interface,android-fragments,Java,Android,Android Layout,User Interface,Android Fragments,我有几个布局: loading.xml reload.xml noresult.xml 这些是线性布局和相对布局 我在其他布局中使用它们,如下所示: <include android:id="@+id/loading" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" layout

我有几个布局:

loading.xml
reload.xml
noresult.xml
这些是线性布局和相对布局

我在其他布局中使用它们,如下所示:

<include
    android:id="@+id/loading"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    layout="@layout/loading"
    android:visibility="gone" />

<include
    android:id="@+id/reload"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    layout="@layout/reload"
    android:visibility="gone" />

<include
    android:id="@+id/noresult"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    layout="@layout/noresult"
    android:visibility="gone" />

您必须在布局本身之前选择布局组:

findViewById(R.id.loading).findViewById(android.R.id.list);

这就是我正在做的。我甚至试着让群组布局可以点击,结果还是一样的:/好吧,我想我误解你了。当您单击一个片段时,是否更新了另一个片段的ListView?您能在哪里发布代码来通知对适配器的更改,以及在哪里将适配器设置为ListView吗?viewpager中添加了两个片段(a和b),每个片段中都有一个ListView。如果我在片段(a)中选择一个单元格,它会在If的顶部弹出一个片段(a1)。假设我在没有internet连接的两个根片段(a和b)中这样做,它会为每个根片段弹出一个片段(a1和b1),在它们上面包含视图“reload”。现在我重新连接internet,并在a1中单击“重新加载”,它将在b1中调用onclick(),并用a1Ok的数据更新b1。你能在重新加载弹出窗口启动连接的地方发布代码,以及相关的回调吗?它和互联网连接一起工作吗?没有回调,我事先测试了互联网连接。是的,一切正常,这是我唯一的问题。我将发布添加片段的代码=)
findViewById(R.id.loading).findViewById(android.R.id.list);