以编程方式添加新片段导致闪烁

时间:2014-10-08 23:41:29

标签: android fragment flicker

我有一个应用程序。例如,我有一个AccountActivity。此活动显示列表视图。单击某个项目(即付款类型)时,我将使用PaymentFragment替换主要内容。当在PaymentFragment中选择一个选项(即添加新的信用卡)时,我用AddCCFragment替换主要内容。所有这些都发生在AccountActivity中。我只是在替换片段。

问题是,如果我以编程方式在AddCCFragment中添加片段,屏幕会闪烁一会儿。

这是一个没有闪烁的执行示例:

  1. AccountActivity具有包含ListView
  2. 的FrameLayout
  3. AccountActivity包含FrameLayout,其中包含PaymentFragment
  4. AccountActivity具有包含AddCCFragment
  5. 的FrameLayout

    以下是使用闪烁执行的示例:

    1. AccountActivity具有包含ListView
    2. 的FrameLayout
    3. AccountActivity包含FrameLayout,其中包含PaymentFragment
    4. AccountActivity包含FrameLayout,其中包含以编程方式添加FragmentABC的AddCCFragment
    5. 第3步发生闪烁。

      感谢。

0 个答案:

没有答案
相关问题