Android View Size Get setLayoutParams(View cover, Display display)

Here you can find the source of setLayoutParams(View cover, Display display)

Description

set Layout Params

Declaration

public static void setLayoutParams(View cover, Display display) 

Method Source Code

//package com.java2s;

import android.graphics.Point;

import android.view.Display;

import android.view.View;

import android.widget.RelativeLayout.LayoutParams;

public class Main {
    public static void setLayoutParams(View cover, Display display) {
        Point size = getDisplaySize(display);
        int width = size.x;
        int height = size.y;

        cover.setLayoutParams(new LayoutParams(width, height));
        cover.setY((float) width);
    }/*from   ww  w.j  a  v  a 2 s  .  c om*/

    public static Point getDisplaySize(Display display) {
        Point size = new Point();
        display.getSize(size);
        return size;
    }
}

Related

  1. measureView(View v)
  2. measureView(View v)