Frage

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?

War es hilfreich?

Lösung 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

Andere Tipps

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);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top