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(R.id.ivHandAnimation);

        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(R.id.btnHole_14).getMeasuredHeight();
        hand.setLayoutParams(lp);

        if (hand != null) {

            hand.setVisibility(View.VISIBLE);
            AnimationDrawable frameAnimation = (AnimationDrawable)hand.getDrawable();
            frameAnimation.setCallback(hand);
            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.
onurtpl
Freshman
Freshman
 
Posts: 2
Joined: Tue Jun 28, 2011 2:37 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 19 guests