我有一个FrameLayout
,其中有一个ImageView
作为子元素。在此ImageView
之上,我让用户通过TextView
创建了一些文本。它工作正常。
但现在我想将FrameLayout
及其ImageView
(以及进一步动态添加的TextViews
)作为一个整体发送。
我该怎么做?
这是我的XML布局:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<FrameLayout
android:id="@+id/image_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".FirstFragment">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:contentDescription="@string/imageview_holding_the_image" />
</FrameLayout>
</layout>
这里是在运行时创建一个简单的TextView
并将其放在FrameLayout
的{{1}}之上的代码,以便原始图像被{{ 1}}:
ImageView
现在,当我想创建该“扩展”图像(原始图像+ TextView)时,该怎么办?