Well, my problem is little bit complicated(for me).
Suppose i have a RelativeLayout
(Or any other Layout
as needed).
Now i make some View
like TextView
.(multiple View
).
Those View
will include following characteristics i will give from java code.
View
to the Layout in a specific position.View
can be overlapped (like following picture)where positionX is will be an integer defining where the View
will be set in the Layout
from top.
Now i want to add those View
to the Layout
like the following photo.
(All View
will be of rectangular size; Sorry for the bad Editing.)
How can i do this? I badly need the solution.
I hope i have explained my problem with my poor English :(
Thank you in advance <3 <3
Try this:
//-----Main Layout-----\\
LinearLayout l1 = findViewById(R.id.myLinear);
ll.setOrientation(LinearLayout.VERTICAL);
//-----First layout-----\\
LinearLayout l11 = new LinearLayout(this);
l11.setBackgroundColor(android.R.color.holo_orange_dark);
l1.addView(l11, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
//-----Second layout-----\\
LinearLayout l12 = new LinearLayout(this);
l12.setBackgroundColor(android.R.color.holo_green_dark);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(-30, 20, 20, 0); //Negative margin top to superposition views
l1.addView(l12, layoutParams);