Navdroid
Navdroid

Reputation: 1549

How to overlap a view over other with three Views in android?

I have an issue : this issue could be understood by following example.

The screen uses three views lets say A,B,C. A is set for Drag and drop on B. What I want is when A is being dragged to B , A should overlap C view but B should overlap A.This makes it three layers B on top,A in middle and C lowest layer.

I dont know how to do this ,with two views it could be implemented but with three how can I solve this Problem.

If anyone cant understand my problem please let me know?Please help?

Upvotes: 0

Views: 543

Answers (3)

Navdroid
Navdroid

Reputation: 1549

Solved my own problem :

Used bringToFront() method in the same sequence I want the views

       A.bringToFront();
       B.bringToFront();

Upvotes: 1

Akshay
Akshay

Reputation: 2534

I think you need to add views dynamically.Try this.

   RelativeLayout rLayout = (RelativeLayout)findViewById(R.id.your_id);

   Button btn = new Button(this);
   btn.setText("Button Name"); // Similarly set different property for the button.

Finally you have to add this button to the respective layout.

   rLayout.addView(btn);   

Upvotes: 1

Hardikgiri Goswami
Hardikgiri Goswami

Reputation: 514

You can do it using "Relative Layout"

Upvotes: 1

Related Questions