karthi B
karthi B

Reputation: 55

layer application in android

I am a new one in Android so please sorry for stupidity. Well my problem is in multiple layers -

I would like to combine two transparent ImageViews one above the other. This is similar to photoshops layers, what is the sample layers activity in android?

Upvotes: 2

Views: 610

Answers (4)

Daud Arfin
Daud Arfin

Reputation: 2499

Well its quite possible to do in android, but the thing is what actually you are going to do with that. you can give the same positions for both the images in layout now both will be overlapped and based on your condition or situation you can show and hide one another programatically. In the same way you can give multiple images overlapped on one another. Hope this will help you out to understand :)

Upvotes: 0

TryTryAgain
TryTryAgain

Reputation: 7820

Already answered Overlapping Views in Android ? That should be all you need, using RelativeLayout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/layout"
>
<ImageView android:id="@+id/imageview1"
    android:background="#00000000"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/image1"
    />

 <ImageView android:id="@+id/imageview2"
    android:background="#00000000"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/image2"
    /> 

</RelativeLayout>

would be an example code for you.

Upvotes: 0

augustin149
augustin149

Reputation: 1

you can use the layer-list, for a full investigation, please refer to http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList

Upvotes: 0

jency
jency

Reputation: 377

You can use a RelativeLayout for this.

The property android:layout_centerInParent If true, centers the child horizontally and vertically within its parent. [boolean]

Similarly there are properties like , android:layout_alignParentLeft,

android:layout_alignParentRight,

android:layout_alignParentTop,

android:layout_alignParentBottom.

Try these.

Upvotes: 1

Related Questions