RelativeLayout MarginLayoutParams resize ImageView

All your problems with Audio, Video and Images.

RelativeLayout MarginLayoutParams resize ImageView

Postby onurtpl » Tue Jun 28, 2011 2:43 pm

Hi All,

I have a ImageView and its src is a animation-list when I try to to set it margins programmatically it also resize the imageview very very small.

In a button click event i set the margin of the image view
Code: Select all
        ImageView hand = (ImageView)rlRoot.findViewById(;

        MarginLayoutParams marginsParams = new MarginLayoutParams(hand.getLayoutParams());
        marginsParams.setMargins(this.getLeft(), rlRoot.getMeasuredHeight() - 20, 0, 0);
        RelativeLayout.LayoutParams lp = new LayoutParams(marginsParams);
        //lp.height = rlRoot.findViewById(;

        if (hand != null) {

            AnimationDrawable frameAnimation = (AnimationDrawable)hand.getDrawable();
            frameAnimation.setVisible(true, true);

I have also tried to set lp.height but it is not working. And I also create LayoutParams with following code.

Code: Select all
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);

Thanks a lot.
Posts: 2
Joined: Tue Jun 28, 2011 2:37 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 18 guests