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?

有帮助吗?

解决方案 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

其他提示

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);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top