congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Display.getSize
Code IndexAdd Tabnine to your IDE (free)

How to use
getSize
method
in
android.view.Display

Best Java code snippets using android.view.Display.getSize (Showing top 20 results out of 2,385)

Refine searchRefine arrow

  • Point.<init>
origin: stackoverflow.com

 Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
origin: stackoverflow.com

 Display mdisp = getWindowManager().getDefaultDisplay();
Point mdispSize = new Point();
mdisp.getSize(mdispSize);
int maxX = mdispSize.x; 
int maxY = mdispSize.y;
origin: stackoverflow.com

 Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
origin: stackoverflow.com

 Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
origin: stackoverflow.com

 private static Point getDisplaySize(final Display display) {
  final Point point = new Point();
  try {
    display.getSize(point);
  } catch (java.lang.NoSuchMethodError ignore) { // Older device
    point.x = display.getWidth();
    point.y = display.getHeight();
  }
  return point;
}
origin: stackoverflow.com

 WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
textView.setWidth(size.x / 3);
origin: stackoverflow.com

 Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);

popWindow = new PopupWindow(inflatedView, size.x - 50,size.y - 500, true );
origin: stackoverflow.com

/* create a full screen window */
 requestWindowFeature(Window.FEATURE_NO_TITLE);
 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
     WindowManager.LayoutParams.FLAG_FULLSCREEN);
 setContentView(R.layout.your_activity);
 /* adapt the image to the size of the display */
 Display display = getWindowManager().getDefaultDisplay();
 Point size = new Point();
 display.getSize(size);
 Bitmap bmp = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(
  getResources(),R.drawable.background),size.x,size.y,true);
 /* fill the background ImageView with the resized image */
 ImageView iv_background = (ImageView) findViewById(R.id.iv_background);
 iv_background.setImageBitmap(bmp);
origin: stackoverflow.com

 public static int getWidth(Context mContext){
  int width=0;
  WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
  Display display = wm.getDefaultDisplay();
  if(Build.VERSION.SDK_INT>12){
    Point size = new Point();
    display.getSize(size);
    width = size.x;
  }
  else{
    width = display.getWidth();  // Deprecated
  }
  return width;
}
origin: stackoverflow.com

 public static int getHeight(Context mContext){
  int height=0;
  WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
  Display display = wm.getDefaultDisplay();
  if(Build.VERSION.SDK_INT>12){
    Point size = new Point();
    display.getSize(size);
    height = size.y;
  }
  else{
    height = display.getHeight();  // Deprecated
  }
  return height;
}
origin: stackoverflow.com

  width = display.getWidth();
} else {
  Point size = new Point();
  display.getSize(size);
  height = size.y;
  width = size.x;
origin: stackoverflow.com

 Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int maxX = size.x; 
int maxY = size.y;
origin: stackoverflow.com

 // `activity` is an instance of Activity class.
Display display = activity.getWindowManager().getDefaultDisplay();
Point screen = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
  display.getSize(screen);
} else {            
  screen.x = display.getWidth();
  screen.y = display.getHeight();
}
origin: stackoverflow.com

 // New width and height
int version = android.os.Build.VERSION.SDK_INT;
Log.i("", " name == "+ version);
Display display = getWindowManager().getDefaultDisplay();
int width;
if (version >= 13) {
  Point size = new Point();
  display.getSize(size);
  width = size.x;
  Log.i("width", "if =>" +width);
}
else {
  width = display.getWidth();
  Log.i("width", "else =>" +width);
}
origin: stackoverflow.com

 public static int getHeight(Context mContext){
  int height=0;
  WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
  Display display = wm.getDefaultDisplay();
  if(Build.VERSION.SDK_INT>Build.VERSION_CODES.HONEYCOMB){               
    Point size = new Point();
    display.getSize(size);
    height = size.y;
  }else{          
    height = display.getHeight();  // deprecated
  }
  return height;      
}
origin: stackoverflow.com

 public static int getWidth(Context mContext){
  int width=0;
  WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
  Display display = wm.getDefaultDisplay();
  if(Build.VERSION.SDK_INT>Build.VERSION_CODES.HONEYCOMB){                   
    Point size = new Point();
    display.getSize(size);
    width = size.x;
  }
  else{
    width = display.getWidth();  // deprecated
  }
  return width;
}
origin: stackoverflow.com

isClosing = true;
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int screenHeight = size.y;
ObjectAnimator positionAnimator = ObjectAnimator.ofFloat(baseLayout, "y", currentPosition, screenHeight+baseLayout.getHeight());
origin: stackoverflow.com

 public void onResume() {
  super.onResume();

  Window window = getDialog().getWindow();
  Point size = new Point();

  Display display = window.getWindowManager().getDefaultDisplay();
  display.getSize(size);

  int width = size.x;

  window.setLayout((int) (width * 0.75), WindowManager.LayoutParams.WRAP_CONTENT);
  window.setGravity(Gravity.CENTER);
}
origin: stackoverflow.com

 Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
origin: stackoverflow.com

 @Override
public float getPageWidth(int page) {
  if(page==0) {
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return (float)LEFT_FRAGMENT_PIXEL_WIDTH / size.x;
  }
  else
    return super.getPageWidth(page);
}
android.viewDisplaygetSize

Popular methods of Display

  • getMetrics
  • getWidth
  • getHeight
  • getRotation
  • getRealMetrics
  • getRealSize
  • getDisplayId
  • getRefreshRate
  • getOrientation
  • getPixelFormat
  • getCurrentSizeRange
  • getName
  • getCurrentSizeRange,
  • getName,
  • getRectSize,
  • getFlags,
  • getState,
  • isValid,
  • toString,
  • getMode,
  • stateToString

Popular in Java

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • setRequestProperty (URLConnection)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • JCheckBox (javax.swing)
  • Option (scala)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now