It is not a duplicate question. I have a xml layout which have alot of things and I'm including 2 layouts which have visibility gone.
<include layout="@layout/some_layout" />
Now I'm adding imageviews dynamically.
layout.addView(imageview);
But it is coming top in the hierarchy of layout. ie Whenever I am setting visibility of my include layout as visible. The dynamically added imageviews overlaps it.
How can I add this down in the hierarchy?
Use layout.addView(view,index);
to add imageview where index is less than the index of included layout.
Add id in your include layout like
<include android:id="@+id/include1" layout="@layout/some_layout" />
Use RalativeLayout
rule like
RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params1.addRule(RelativeLayout.BELOW, R.id.include1);
layout.addView(imageview, params1);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.