How does Android's setDrawingCacheEnabled() work?

前端 未结 2 971
盖世英雄少女心
盖世英雄少女心 2021-02-02 10:35

I have a UI where the root layout is a RelativeLayout. It has a number of Views, such as fields, buttons, etc.

There are also two other panels that are initially invisib

2条回答
  •  被撕碎了的回忆
    2021-02-02 10:54

    You may want to build your drawing cache before using it, otherwise It will give you a blank bitmap

      public void someButtonClicked(View view) {
        detailPanel.startAnimation(detailEnterAnimation);
        detailPanel.setVisibility(View.VISIBLE);
        detailPanel.setDrawingCacheEnabled(true);
        detailPanel.buildDrawingCache();  //may be you need to add this?
      }
    

提交回复
热议问题