Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlay image over another android

I have photo album which shows the image as rounded with white border. Image will be adding dynamically. I tried frame layout but it it not working for me. My try : Adding dynamic image over already existing round shape image..

<FrameLayout
   android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<ImageView 
    android:id="@+id/image"
    android:layout_width="60dip"
    android:layout_height="60dip"
    android:adjustViewBounds="true"
    android:scaleType="centerCrop" />

<ImageView 
    android:id="@+id/imagef"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:background="@drawable/ph_bg" />
</FrameLayout>

Above xml not giving exact result .. any idea ?

like image 423
user2291423 Avatar asked May 28 '13 13:05

user2291423


1 Answers

Use below xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageView
        android:id="@+id/image"
        android:layout_width="60dip"
        android:layout_height="60dip"
        android:adjustViewBounds="true"
        android:layout_centerInParent="true"
        android:scaleType="centerCrop" />

    <ImageView
        android:id="@+id/imagef"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerInParent="true"
        android:background="@drawable/ph_bg" />

</RelativeLayout>

This will do your task.

Happy coding :)

like image 90
Pankaj Kumar Avatar answered Sep 28 '22 05:09

Pankaj Kumar