Android的,如何把一个图像在另一个图像? [英] Android, How to put an image over another image?

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

问题描述

在项目中,我有一个菜单。菜单设计我想使用GridView控件。
为简单起见,假设这个网格视图中只有一个项目。该项目有两个单独的图像(background.png和news.png)和文本(例如新闻)。

In my project I have a menu. for design of menu i want to use gridView. for simplicity assume that this grid view has just one item. This item has two seperate images (background.png and news.png) and a text (for example "NEWS").

是否有可能映射news.png通过XML或code background.png?

Is it possible to map news.png on background.png through xml or code?

感谢您帮助我。

推荐答案

是的,你可以随时做,使用的FrameLayout 在XML文件中,就像这样。

Yes you can always do that using FrameLayout in xml file,Like this.

<FrameLayout android:id="@+id/frameLayout1"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <ImageView android:id="@+id/imageView1" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:src="@drawable/background"></ImageView>
    <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content"
        android:layout_gravity="center" android:layout_height="wrap_content"
        android:src="@drawable/news"></ImageView>
    <TextView android:text="NEWS" android:id="@+id/textView1" android:layout_gravity="bottom|center_horizontal"
        android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</FrameLayout>

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

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