首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓,ImageView上的ImageView

安卓,ImageView上的ImageView
EN

Stack Overflow用户
提问于 2012-07-13 17:53:41
回答 2查看 19.2K关注 0票数 12

我有一个非常简单的问题要问:我需要在ImageView上放一个小徽标,整个屏幕都是大的,在屏幕的右下角区域,但我不知道如何设置坐标或如何说ImageViews处于相对位置。

如下所示:

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-07-13 18:02:19

尝尝这个

代码语言:javascript
复制
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_launcher" />

</RelativeLayout>

输出

票数 11
EN

Stack Overflow用户

发布于 2012-07-13 18:02:34

使用FrameLayout。

根据Google Blogspot示例的

代码语言:javascript
复制
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView  
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 

        android:scaleType="center"
        android:src="@drawable/golden_gate" />

    <TextView
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginBottom="20dip"
        android:layout_gravity="center_horizontal|bottom"

        android:padding="12dip"

        android:background="#AA000000"
        android:textColor="#ffffffff"

        android:text="Golden Gate" />

</FrameLayout>

将为您提供以下输出

只需调整它以满足您的需求。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11468146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档