如何在ImageView上添加文字

 
ImageView中是不能写文字的 如果说你单单的只是向实现 文字覆盖图片的这个需求的话 你可以考虑使用帧布局。
运行结果是字符串覆盖在图片上
复制内容到剪贴板
代码:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <ImageView  
        android:layout_width="wrap_content"   
        android:layout_height="wrap_content"  
        android:src="@drawable/image"  
    />  
    <TextView  
        android:layout_width="wrap_content"   
        android:layout_height="wrap_content"  
        android:text="雨松MOMO"  
        android:background="#FF0000"  
        android:textColor="#000000"    
        android:textSize="18dip"    
    />  
</FrameLayout>

www.it51share.com

猜你喜欢

转载自wmcxy.iteye.com/blog/2021593