我有這樣的FrameLayout在我的LinearLayout:機器人轉換的FrameLayout來繪製
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/desktopsFramelayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="none"
android:src="@drawable/accept" />
</FrameLayout>
然後在代碼中,我試圖將其轉換在繪製對象是這樣的:
FrameLayout desktopFrameLayout = (FrameLayout)findViewById(R.id.desktopsFramelayout);
desktopFrameLayout.setDrawingCacheEnabled(true);
desktopFrameLayout.buildDrawingCache();
Bitmap bitmap = desktopFrameLayout.getDrawingCache();
的bitmap
是null
,爲什麼? ?