开发者

Need to dynamically relocate the position of an image

开发者 https://www.devze.com 2023-04-06 15:19 出处:网络
Is it possible to do so? A workaround would be to put in two copies of the same image at the starting place and the ending place with the visibility of the first set to visible and the end position to

Is it possible to do so? A workaround would be to put in two copies of the same image at the starting place and the ending place with the visibility of the first set to visible and the end position to invisible and swap their visibiliti开发者_开发问答es dynamically on button click. That would work. But is there any in-built function that would actually enable me to relocate the image? thanks and cheers !


Well you could change the layout parameters for the imageview

Like

 LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
        LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
 lp.topMargin = 10;

 imageview.setLayoutParams(lp);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号