如何设置文本在一个ImageView的? [英] how to set a text over an imageView?

查看:197
本文介绍了如何设置文本在一个ImageView的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我放置一个应用程序栏在屏幕的顶部和它看起来如下图所示:

I am placing an application bar on the top of the screen and it looks as the following figure:

现在我想设置一个文本上的图像,使图像看起来如下:

Now i want to set a text over the image, so that the image looks as follows:

如何设置一个文本上的形象?在此先感谢

How to set a text over an image? Thanks in advance

推荐答案

请尝试以下code。

<?xml version="1.0" encoding="utf-8"?>

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" 
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:background="@drawable/your background image">


            <LinearLayout 
                android:layout_height="fill_parent"
                android:layout_width="fill_parent" 
                android:layout_weight="1"
                android:gravity="center" 
                android:orientation="vertical">

                <TextView 
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" 
                    android:textColor="@color/white"
                    android:textSize="18sp" 
                    android:textStyle="bold"
                    android:singleLine="true" 
                    android:text="Subject"/>

            </LinearLayout>

</LinearLayout>

这篇关于如何设置文本在一个ImageView的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆