List of usage examples for android.view View getLayoutParams
@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_") public ViewGroup.LayoutParams getLayoutParams()
From source file:Main.java
public static void measureView(View view) { ViewGroup.LayoutParams p = view.getLayoutParams(); if (p == null) { p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); }//from ww w . ja v a 2 s . c o m int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, p.width); int lpHeight = p.height; int childHeightSpec; if (lpHeight > 0) { childHeightSpec = View.MeasureSpec.makeMeasureSpec(lpHeight, View.MeasureSpec.EXACTLY); } else { childHeightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); } view.measure(childWidthSpec, childHeightSpec); }
From source file:Main.java
public static void measureView(View view) { ViewGroup.LayoutParams p = view.getLayoutParams(); if (p == null) { p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); }/*from w ww . j av a 2 s . com*/ int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, p.width); int lpHeight = p.height; int childHeightSpec; if (lpHeight > 0) { childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY); } else { childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); } view.measure(childWidthSpec, childHeightSpec); }
From source file:Main.java
static float getViewWeight(View view) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) view.getLayoutParams(); return lp.weight; }
From source file:Main.java
/** * Set size for view.//from w ww .ja v a 2s.c o m * * @param view * @param width * @param height */ public static void size(View view, int width, int height) { LayoutParams params = view.getLayoutParams(); params.height = height; params.width = width; view.setLayoutParams(params); }
From source file:Main.java
public static void setViewSize(View view, int width, int height) { ViewGroup.LayoutParams params = view.getLayoutParams(); params.width = width;//from w w w . j av a2s . co m params.height = height; view.setLayoutParams(params); }
From source file:Main.java
public static void setViewLayoutParams(View view, int width, int height) { ViewGroup.LayoutParams params = view.getLayoutParams(); params.width = width;/*www. j a v a2 s . c om*/ params.height = height; view.setLayoutParams(params); view.requestLayout(); }
From source file:Main.java
public static void changeH(View v, int H) { ViewGroup.LayoutParams params = (ViewGroup.LayoutParams) v.getLayoutParams(); params.height = H;/*from ww w. j a va2 s. c o m*/ v.setLayoutParams(params); }
From source file:Main.java
public static void changeW(View v, int W) { ViewGroup.LayoutParams params = (ViewGroup.LayoutParams) v.getLayoutParams(); params.width = W;//from ww w . ja va 2 s. c o m v.setLayoutParams(params); }
From source file:Main.java
public static void setViewSize(View view, int width, int height) { LayoutParams params = (LayoutParams) view.getLayoutParams(); params.width = width;//from ww w. j a v a 2 s . c o m params.height = height; view.setLayoutParams(params); }
From source file:Main.java
public static void setSize(View view, int width, int height) { ViewGroup.LayoutParams lp = view.getLayoutParams(); if (lp == null) { lp = new ViewGroup.LayoutParams(width, height); } else {//from ww w . j a va 2s .c o m lp.height = height; lp.width = width; } view.setLayoutParams(lp); }