在PageViewer Android中从BaseAdapter类内部调用片段
嗨,我是Android新手,在我的项目中使用PageViewer来显示标签滑动和其他类似的东西 我使用了4个选项卡,每个选项卡使用了片段 现在,我有一个标签列表,上面有一个按钮可以调用同一标签上的另一个片段,也就是说,我需要替换同一标签上的片段 我碰到了这个堆栈问题,如链接中所示,该链接说使用广播侦听器调用片段。我在片段类中使用了它在PageViewer Android中从BaseAdapter类内部调用片段,android,android-fragments,tabs,transactions,android-viewpager,Android,Android Fragments,Tabs,Transactions,Android Viewpager,嗨,我是Android新手,在我的项目中使用PageViewer来显示标签滑动和其他类似的东西 我使用了4个选项卡,每个选项卡使用了片段 现在,我有一个标签列表,上面有一个按钮可以调用同一标签上的另一个片段,也就是说,我需要替换同一标签上的片段 我碰到了这个堆栈问题,如链接中所示,该链接说使用广播侦听器调用片段。我在片段类中使用了它 http://stackoverflow.com/questions/22265378/how-to-call-a-fragment-from-baseadapte
http://stackoverflow.com/questions/22265378/how-to-call-a-fragment-from-baseadapter-class-android/22265433#22265433
我得到一个错误,我需要调用框架布局
由于它使用android id,如果我将其更改为@+id,则会给出错误消息
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" >
</FrameLayout>
我显示选项卡的布局如下所示,我正在使用android.support.v4库进行Fragement。请帮忙
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="900dp"
android:layout_alignParentBottom="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" >
</FrameLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="fill_parent"
android:layout_height="135dp"
android:layout_weight="1" >
</android.support.v4.view.ViewPager>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</TabWidget>
</LinearLayout>
</TabHost>
使用以下方法:
Fragment.replace("res_id",fragement to replace);
尝试
fragmentTransaction.replace(android.R.id.tabcontent,fieldvisitFragment)代码>替换它。。。但现在,如果我单击“无任何事情发生”…我如何在清单文件中注册此receiverHave used fragmentTransaction.replace(android.R.id.tabcontent,fieldvisitFragment)
Fragment.replace("res_id",fragement to replace);