如何在从 CardView 生成位图之前从 CardView 中删除按钮视图?

How to remove a Button View from CardView before generating a bitmap from the CardView?

我在 Android 应用程序中有一个 CardView,它可以作为位图共享。在生成位图之前,如何从 CardView 中删除 Button View?这可能吗?

你是如何生成位图的。最简单的方法是通过

隐藏按钮
setVisibility(GONE);

生成位图之前。