简体   繁体   中英

Android fragment overlapping

i am making a app. That have multiple fragments, but i don't know why they overlap sometime not always. specially on tab. could anyone tell me please whats the reason behind it

**

Set the background to your root view in your xml. It will solve your overlapping issue. The main reason behind is that you are not handling fragment back stack properly. if you do so nicely this issue will not happen but you can get rid of from this issue by simply adding background in your xml. If you really want to correct your code you have to post your code there.

This problem usually happens.

make sure you are using FragmentTransaction.replace() instead of FragmentTransaction.add() .

Also make sure :

  • using android.support.v4.app.Fragment
  • using getSupportFragmentManager() etc
  • define a android:background on the root element of your XMLs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM