質問

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