android - How to place the Floating Action Button exclusively on one fragment only in Tab layout -


i trying achieve following no success.i have 2 material design swipe tabs.i used this library 'com.oguzdev:circularfloatingactionmenu:1.0.2' achieve fab when swipe tab second tab,the fab still attached new fragment.

i hide fab on second fragment. there way achieve this?

here did similar kind of problem. declared coordinator layout fragment. inside coordinator layout can see in image have declared recyclerview use , below declared floating action button.

after inflated layout floating action button in oncreateview fragment method.

here xml file code:

<android.support.design.widget.coordinatorlayout android:id="@+id/main_content"     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:focusableintouchmode="true">      <edittext         android:id="@+id/search_string"         android:layout_width="match_parent"         android:layout_height="40dp"         android:layout_margin="5dp"         android:layout_margintop="50dp"         android:hint="search keyword"         android:drawableleft="@drawable/search"         android:gravity="left" >     </edittext>  <android.support.v7.widget.recyclerview     xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/photo_recycler_view"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_margintop="50dp"     android:scrollbars="vertical"/>  <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@drawable/ic_action_name6" /> </android.support.design.widget.coordinatorlayout> 

here java file code:

@override     public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {         view view = inflater.inflate(r.layout.fragment_photo_list, container, false);          floatingactionbutton fab = (floatingactionbutton) view.findviewbyid(r.id.fab);         fab.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view view) {                 photo photo = new photo();                 photolab.get(getactivity()).addphoto(photo);                 intent intent = photopageractivity.newintent(getactivity(), photo.getid());                 startactivity(intent);                 /*snackbar.make(view, "replace own action", snackbar.length_long)                         .setaction("action", null).show();*/                 }         });          msearchstring=(edittext) view.findviewbyid(r.id.search_string);         mphotorecyclerview = (recyclerview) view.findviewbyid(r.id.photo_recycler_view);         mphotorecyclerview.setlayoutmanager(new gridlayoutmanager(getactivity(), 3));          updateui();         return view;     } 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -