如何在android中将textview转换为imageview?
我有一个文本视图,有大文本。我想将其转换为一个图像视图,其高度和宽度与文本视图相同。图像应显示为文本视图,即如果android欢迎文本,则单击转换按钮时,图像视图也应以与文本视图相同的方式显示。请帮助我。我的xml文件为如何在android中将textview转换为imageview?,android,textview,imageview,Android,Textview,Imageview,我有一个文本视图,有大文本。我想将其转换为一个图像视图,其高度和宽度与文本视图相同。图像应显示为文本视图,即如果android欢迎文本,则单击转换按钮时,图像视图也应以与文本视图相同的方式显示。请帮助我。我的xml文件为 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_w
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/relative" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="96dp"
/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="99dp"
android:text="Convert" />
</RelativeLayout>
你可以用。
位图bmp=view.getDrawingCache;
ImageView.setImageBitmapbmp 您可以使用按钮而不是ImageView根据我的要求,我应该只使用图像视图。感谢您的回复。您能说出您不能使用按钮的要求是什么吗?将文本转换为图像视图,或者大部分转换为图像?如果文本的长度超出活动的宽度,然后它进入第二行,但我希望它在一行中,不管文本的长度是多少。