android - ListView and onItemClick create transparent fragment -


i have problem. use fragment list view, , after click on item should replace fragment fragment particular fragment (in case, events). works (the fragment shown) transparent, can see list in background (even though not clickable). how can rid of weird background? other fragment replacing similar methods works fine, "onitemclick" this.

here code:

lvevents.setonitemclicklistener(new adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview<?> parent, view view, int position,                                     long id) {                 event currevent = (event) parent.getadapter().getitem(position);                 log.e(tag, currevent.getname().tostring());                 replacefragment(0, currevent);             }         }); 

and method:

 private void replacefragment(int code, event event) {         fragmenttransaction ft = getactivity().getsupportfragmentmanager().begintransaction();         bundle b = new bundle();         b.putparcelable("event",event);          if(code==0){             eventviewfragment fragment = new eventviewfragment();             fragment.setarguments(b);             ft.replace(r.id.fragmentframe, fragment, eventviewfragment.tag);         }         ft.commit();     } 

any ideas might wrong here?

thank in advance!

regards,

grzegorz

try .. faced problem ... went through few articles ... written can use white background in main layout ... in frame layout or linear layout in case. use android:background="@color/white"

<linearlayout android:id="@+id/timetable_fragment" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:background="@color/white" android:layout_height="match_parent">      <android.support.v7.widget.recyclerview         android:id="@+id/card_list"         android:layout_width="match_parent"         android:layout_height="wrap_content">      </android.support.v7.widget.recyclerview> </linearlayout> 

you can can use method then.. replaces current fragment... using replace keyword..and onto if want use addtobackstack keyword stack fragments.

public void replacefragment(fragment fragment) {     getsupportfragmentmanager()             .begintransaction()             .replace(r.id.container, fragment)             .addtobackstack(null)             .commit(); } 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -