我有两个视图(TextView
和 ImageView
)在 FrameLayout
中,我想保存图像和文本。为此,我将 View 转换为位图。
我的 XML 代码如下:
<FrameLayout
android:id="@+id/framelayout"
android:layout_marginTop="30dip"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<ImageView
android:id="@+id/ImageView01"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
<TextView android:id="@+id/text_view"
android:layout_marginTop="30dip"
android:layout_width="wrap_content"
android:maxLines="20"
android:scrollbars="vertical"
android:layout_height="wrap_content"/>
</FrameLayout>
getDrawingCache()
返回null
。然后我找到了这个答案:https://dev59.com/UHE95IYBdhLWcg3wXsyR#4618030 - Amiraslan