change View Width - Android User Interface

Android examples for User Interface:View Size

Description

change View Width

Demo Code


//package com.java2s;
import android.view.View;
import android.view.ViewGroup.LayoutParams;

public class Main {

    public static void changeW(View v, int W) {
        LayoutParams params = (LayoutParams) v.getLayoutParams();
        params.width = W;/* w  w  w  .  j a  v  a  2 s . co  m*/
        v.setLayoutParams(params);
    }
}

Related Tutorials