2014-11-22 34 views
-1

一个图像附加到图像视图一个图像附加到图像视图

android:src="@drawable/image name" 
+0

请把更多的代码 – AabidMulani 2014-11-22 18:31:06

+0

这里是它应该是什么样子:应该是这样的:https://onedrive.live.com/redir?resid= 90D26B3C24DAF89C%21123 – 2014-11-22 18:31:24

回答

0

ImageView中,您可以将红色圆形图像设置为background,将主图像设置为src并将其设置为scaleType

否则你的两个ImageView在FrameLayoutRelativeLayout

但是,您需要确保超出红色边界的颜色应该是不透明的并填充背景颜色。 它就像隐藏了图像顶部的内部图像的额外部分。

添加的代码:

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/white"> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:id="@+id/imageView_main_image" 
     android:background="@drawable/your_main_image_here"/> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:id="@+id/imageView_background_image" 
     android:layout_alignRight="@+id/imageView_main_image" 
     android:layout_alignBottom="@+id/imageView_main_image" 
     android:layout_alignLeft="@+id/imageView_main_image" 
     android:layout_alignTop="@+id/imageView_main_image" 
     android:background="@drawable/your_border_image_here"/> 

</RelativeLayout> 

enter image description here

+0

你能提供一些代码 – 2014-11-22 18:45:03

+0

@gaerdarrd做了这项工作吗? – AabidMulani 2014-11-22 19:11:46

+0

不,它不起作用 - 由于边框图像,图像完全掩盖了框架 – 2014-11-22 19:17:39

0

可以在ImageView的和图像本身作为ImageView的的src使用fragme可绘制为background,像这样

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/frame" 
    android:src="@drawable/image"/> 
+0

这不起作用 – 2014-11-22 18:36:22