我有一个 android 项目,我在其中使用相机并将照片保存在 imageView 中。所以,我想在这个 imageView 上粘贴一些文本。这是可能的 ??
问问题
203 次
4 回答
1
在你的里面写这样的东西RelativeLayout
:
<ImageView
android:id="@+id/myImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/imageSouce" />
<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textview1"
android:layout_alignTop="@+id/textview1"
android:layout_alignRight="@+id/textview1"
android:layout_alignBottom="@+id/textview1"
android:layout_margin="1dp"
android:gravity="center"
android:text="Hello"
android:textColor="#000000" />
或者,想以编程方式进行吗?然后按照..
于 2013-07-09T16:44:48.353 回答
0
创建一个RelativeLayout
或FrameLayout
包含你的ImageView
和一个TextView
。将TextView
出现在ImageView
.
于 2013-07-09T16:31:42.387 回答
0
使用TextView
并将图像背景设置为文本视图。
或者
如果要使用图像视图,请创建&TextView
并将其放置在.TextView
ImageView
RelativeLayout
于 2013-07-09T16:37:13.937 回答
0
跟着这些步骤 :
第 1 步:首先将布局更改为RelativeLayout
第 2 步:单击并拖动工作区中的imageview按钮,然后选择存储在可绘制文件夹中的图像。
第 3 步:选择TextView
并将其拖到图像的中心。(右键单击-EditText-更改为您想要的文本)。
您还可以使用textStyle或textSize使文本变大并进行格式化。
这是简单的示例代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/sm" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="148dp"
android:textStyle="bold"
android:text="Here is my text " />
</RelativeLayout>
结果 :
于 2013-07-09T17:07:58.290 回答