Question

I have Image in my layout and I want when user clicked on image, 4 drawable (corner button) added in corner of the image. How can I do this?

Was it helpful?

Solution 2

well there are many ways to that.

Using layoutparams you can set layout params programatically.

like

LayoutParams param = new LayoutParam(LayoutPara.width, LayoutParam.height);
//your rules...

imageView.setlayoutParams(param); 

here you can set margintop, bottom, left and right and alignParentLeft.... so on

OTHER TIPS

Add id field to the relative layout in the xml. Use that id in the class to create view dynamically.

RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.YourID);
imageView.setImageDrawable(R.drawable.image);  
//Add View to Layout:    
relativeLayout.addView(imageView);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top