List of usage examples for android.view View getLayoutParams
@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_") public ViewGroup.LayoutParams getLayoutParams()
From source file:Main.java
static void setViewWidth(View view, int width) { view.getLayoutParams().width = width; view.requestLayout(); }
From source file:Main.java
public static void setViewsWidthPx(Context context, int pxValue, View view) { LayoutParams lp = view.getLayoutParams(); lp.width = pxValue;/* w ww . java 2 s. c o m*/ }
From source file:Main.java
public static void setViewsHeightPx(Context context, int pxValue, View view) { LayoutParams lp = view.getLayoutParams(); lp.height = pxValue;//from w w w.ja v a 2s. com }
From source file:Main.java
public static void updateViewLayoutParams(View view, int width, int height) { if (view.getLayoutParams() == null || view.getLayoutParams().height != width || view.getLayoutParams().width != height) { view.getLayoutParams().width = width; view.getLayoutParams().height = height; }/*from www .j ava 2s . com*/ }
From source file:Main.java
public static void scaleViewToDp(View view, int width, int height) { view.getLayoutParams().width = dpToPx(width); view.getLayoutParams().height = dpToPx(height); }
From source file:Main.java
public static void scaleTwiceHeight(View v) { LayoutParams params = (LayoutParams) v.getLayoutParams(); params.height = params.height * 2;//from w w w. ja v a 2 s .co m v.setLayoutParams(params); }
From source file:Main.java
public static Bitmap loadBitmapFromView(View v) { Bitmap b = Bitmap.createBitmap(v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888);// www. ja va 2 s.c om Canvas c = new Canvas(b); v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height); v.draw(c); return b; }
From source file:Main.java
public static BitmapDrawable createDrawableFromView(Context context, View v) { Bitmap b = Bitmap.createBitmap(v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888);/*w w w . j a v a 2 s. co m*/ Canvas c = new Canvas(b); v.layout(v.getLeft(), v.getTop(), v.getRight(), v.getBottom()); v.draw(c); return new BitmapDrawable(context.getResources(), b); }
From source file:Main.java
public static void setWidth(View view, int width) { if (view == null || view.getLayoutParams() == null) { throw new IllegalArgumentException("View LayoutParams is null"); }/*from w ww .j a v a 2s . c o m*/ ViewGroup.LayoutParams params = view.getLayoutParams(); params.width = width; view.setLayoutParams(params); }
From source file:Main.java
public static void setHeight(View view, int height) { if (view == null || view.getLayoutParams() == null) { throw new IllegalArgumentException("View LayoutParams is null"); }/*w ww . j a v a2 s . c o m*/ ViewGroup.LayoutParams params = view.getLayoutParams(); params.height = height; view.setLayoutParams(params); }