Java 将多个文本视图合并到位图-我应该使用画布吗?
我发现您可以将Java 将多个文本视图合并到位图-我应该使用画布吗?,java,android,canvas,bitmap,Java,Android,Canvas,Bitmap,我发现您可以将文本视图添加或合并到位图。我有4个文本视图,我想合并到图像的顶部 下面是我想要实现的屏幕截图(尽管目前这是图片顶部的文本视图): 图像位于文本视图下方。右上角的图像标题表示的是图像编号 因此,我试图做的是,一旦我单击send按钮,它就会“打印”或将这些文本视图合并到下面的图像位图上,这样我就可以将图像(其中包含textview)作为一个文件保存或发送到我的服务器/设备 到目前为止,我已经使用了Canvas.draw()方法,尽管它似乎会相互覆盖,并且我正在尝试保持与屏幕截图相同的
文本视图
添加或合并到位图
。我有4个文本视图
,我想合并到图像的顶部
下面是我想要实现的屏幕截图(尽管目前这是图片顶部的文本视图):
图像位于文本视图下方。右上角的图像标题表示的是图像编号
因此,我试图做的是,一旦我单击send
按钮,它就会“打印”或将这些文本视图合并到下面的图像位图上,这样我就可以将图像(其中包含textview
)作为一个文件保存或发送到我的服务器/设备
到目前为止,我已经使用了Canvas.draw()
方法,尽管它似乎会相互覆盖,并且我正在尝试保持与屏幕截图相同的布局
有人能帮忙吗?试试这个
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottomLayID"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:padding="8dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Detail work order"
android:textStyle="bold"
android:gravity="center"
android:layout_weight="0.5"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Image"
android:textStyle="bold"
android:gravity="center"
android:layout_weight="1.5"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:padding="8dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:gravity="center"
android:layout_weight="0.5"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:gravity="center"
android:layout_weight="1.5"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/bottomLayID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Open Camera"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Send Image"
android:background="#99d72e"/>
</LinearLayout>
</RelativeLayout>
ImageView mImg;
mImg = (ImageView) findViewById(R.id.(your xml img id));
mImg.setImageBitmap(img);