Android Question Strange lag/bad performance when switching layouts in a panel

Discussion in 'Android Questions' started by Yuri Cinesi, Dec 31, 2017.

  1. Yuri Cinesi

    Yuri Cinesi Member Licensed User

    I have an app that has a top bar with a button to show a sliding menu (done with slidingmenuwrapper) and a label that indicates what "page" you're currently on. The rest of the UI is a Panel.

    The menu contains some buttons that allow you to switch between several pages by loading different layouts in the panel. Whenever I load a different layout than the first one the entire app seems to lag. As soon as I switch back to the initial layout this lag disappears. I don't think it's related to the amount of objects present in the layouts as one of them is comprised only of a single imageview (since it's still WIP).

    I don't know what could be causing this lag. I can post the entire project if necessary, or any relevant parts since it's pretty big. Any help is highly appreciated.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Are you testing it in release mode?
     
  3. Yuri Cinesi

    Yuri Cinesi Member Licensed User

    Yeah, I'm using release mode.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Try to reproduce it in a small project and upload the project.
     
  5. Yuri Cinesi

    Yuri Cinesi Member Licensed User

    Fixed it. Basically I had an imageview within the slidingmenu that was just completely black, to act as a line between the menu and the rest of the UI. The image I loaded into it was about 20kb and apparently too large. Making it smaller (about 1kb) fixed the issue completely.
    Still not sure why the lag was so inconsistent, but whatever. It's gone now.
     
  6. RandomCoder

    RandomCoder Well-Known Member Licensed User

    If the Imageview is just a black image then it might be better/faster and far less memory consuming to use a panel with a black background?
    Just an idea for you to consider.
     
    Yuri Cinesi likes this.
  7. Yuri Cinesi

    Yuri Cinesi Member Licensed User

    I'll try that, thanks for the tip.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice