The location, size, and new animations of the Android dynamic control component

Source: Internet
Author: User

First, dynamically set the location of the component where view is the control that needs to change position, top is the position to be set, the private static void Setlayoutx (View view,int top)  {//The width of the clone view, The value of height, margin generates a margin object   marginlayoutparams margin=new marginlayoutparams (View.getlayoutparams ());//Set a new margin   Margin.setmargins (Margin.leftmargin+350,top,margin.rightmargin,margin.bottommargin);// Create a new margin Layoutparams object   relativelayout.layoutparams layoutparams = new Relativelayout.layoutparams (margin);// New location for view   View.setlayoutparams (layoutparams); }  Two, dynamically set the size and animation of components/**  *   * @param view The components you need to set   * @param height you need to set up   * @param width you need to set the widths   * @param animation need to set the animation   */private static void Setlayoutscale (View view,int height,int width,layoutanimationcontroller.animationparameters animation)  {   Relativelayout.layoutparams layoutparams = new Relativelayout.layoutparams (View.getlayoutparams ());  layoutparams.height=height;  layoutparams.width=width;  Layoutparams.layoutanimationparameters=animation;  View.setlayoutparams (layoutparams);  }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.