Java 是否有办法仅选择ImageView和Textview的内容,并将其下载为图像文件保存在设备存储器中?
我想创建一个下载按钮,以便用户可以将ImageView和TextView(位于ImageView顶部)的内容下载为图像文件,并将其保存在设备存储器中 以下是代码块:Java 是否有办法仅选择ImageView和Textview的内容,并将其下载为图像文件保存在设备存储器中?,java,android,xml,android-layout,Java,Android,Xml,Android Layout,我想创建一个下载按钮,以便用户可以将ImageView和TextView(位于ImageView顶部)的内容下载为图像文件,并将其保存在设备存储器中 以下是代码块: <ImageButton android:id="@+id/back_btn" android:layout_width="50dp" android:layout_height="50dp" android:background="@mipmap/ic_back" androi
<ImageButton
android:id="@+id/back_btn"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_back"
android:layout_marginTop="20dp"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/quotes_background"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/quoteBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="20sp"
android:typeface="monospace"
android:textColor="@color/white"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>
<TextView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="25sp"
android:layout_below="@id/quoteBody"
android:textColor="@color/white"
android:layout_marginTop="20px"
android:gravity="center"/>
我只想选择ImageView和两个TextView,并将它们作为图像(PNG)下载。任何帮助都将不胜感激
谢谢。您可能希望保存屏幕上显示的位图。请参阅。您的问题不清楚。您不需要下载
TextView
和ImageView
,这些都是Android组件。您必须下载内容并在运行时视图上进行设置。@JonZarate我道歉。我可能把问题框错了。我的目标是为用户创建一个下载按钮。使用它,用户可以将TextView和ImageView的内容作为图像文件一起下载。感谢您为我提供了正确的路径。我能够将视图封装在Framelayout中,并将Framelayout转换为位图。然后我将位图保存为PNG文件。