android Programming Glossary: getwindowmanager
How to get screen dimensions http://stackoverflow.com/questions/1016896/how-to-get-screen-dimensions dimensions in pixels you can use getSize Display display getWindowManager .getDefaultDisplay Point size new Point display.getSize size.. getHeight methods that are now deprecated Display display getWindowManager .getDefaultDisplay int width display.getWidth deprecated int..
How to use the gridlayout to fit screen size http://stackoverflow.com/questions/10347846/how-to-use-the-gridlayout-to-fit-screen-size tiled layout in the Google Play app. Point size new Point getWindowManager .getDefaultDisplay .getSize size int screenWidth size.x int..
Android Drag and drop images on the Screen? http://stackoverflow.com/questions/11027792/android-drag-and-drop-images-on-the-screen setContentView R.layout.main windowwidth getWindowManager .getDefaultDisplay .getWidth windowheight getWindowManager .getDefaultDisplay.. getWindowManager .getDefaultDisplay .getWidth windowheight getWindowManager .getDefaultDisplay .getHeight System.out.println width windowwidth.. Write Below Code into your Activity File. windowwidth getWindowManager .getDefaultDisplay .getWidth windowheight getWindowManager .getDefaultDisplay..
Detect 7 inch and 10 inch tablet programmatically http://stackoverflow.com/questions/15055458/detect-7-inch-and-10-inch-tablet-programmatically metrics object DisplayMetrics metrics new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics metrics From this we can get..
Is there a way to determine android physical screen height in cm or inches? http://stackoverflow.com/questions/2193457/is-there-a-way-to-determine-android-physical-screen-height-in-cm-or-inches Use the following DisplayMetrics dm new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics dm double x Math.pow dm.widthPixels..
How to layout text to flow around an image http://stackoverflow.com/questions/2248759/how-to-layout-text-to-flow-around-an-image String text getString R.string.text Display display getWindowManager .getDefaultDisplay FlowTextHelper.tryFlowText text thumbnailView..
Android - LinearLayout Horizontal with wrapping children http://stackoverflow.com/questions/2961777/android-linearlayout-horizontal-with-wrapping-children ll ArrayList collection String header Display display getWindowManager .getDefaultDisplay int maxWidth display.getWidth 10 if collection.size..
Size of android notification bar and title bar? http://stackoverflow.com/questions/3600713/size-of-android-notification-bar-and-title-bar I obtain display width and height with Display display getWindowManager .getDefaultDisplay int width display.getWidth int height display.getHeight.. like that DisplayMetrics metrics new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics metrics int myHeight 0 switch..
Touch and drag image in android http://stackoverflow.com/questions/4255859/touch-and-drag-image-in-android savedInstanceState super.onCreate savedInstanceState int w getWindowManager .getDefaultDisplay .getWidth 25 int h getWindowManager .getDefaultDisplay.. w getWindowManager .getDefaultDisplay .getWidth 25 int h getWindowManager .getDefaultDisplay .getHeight 25 BallView ballView new BallView..
Android: Showing wrong screen resolution http://stackoverflow.com/questions/5078808/android-showing-wrong-screen-resolution using this code DisplayMetrics dm new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics dm str_ScreenSize dm.widthPixels..
Screen orientation lock http://stackoverflow.com/questions/6599770/screen-orientation-lock .getConfiguration .orientation final int rotation getWindowManager .getDefaultDisplay .getOrientation if rotation Surface.ROTATION_0.. else int rotation getWindowManager .getDefaultDisplay .getRotation if rotation android.view.Surface.ROTATION_90.. else int rotation getWindowManager .getDefaultDisplay .getRotation if rotation android.view.Surface.ROTATION_0..
Determine if the device is a smartphone or tablet? http://stackoverflow.com/questions/9279111/determine-if-the-device-is-a-smartphone-or-tablet work for me now DisplayMetrics metrics new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics metrics int width metrics.widthPixels..
How to get screen dimensions http://stackoverflow.com/questions/1016896/how-to-get-screen-dimensions share improve this question If you want the the display dimensions in pixels you can use getSize Display display getWindowManager .getDefaultDisplay Point size new Point display.getSize size int width size.x int height size.y If you're not in an Activity.. introduced in API level 13 you could use the getWidth and getHeight methods that are now deprecated Display display getWindowManager .getDefaultDisplay int width display.getWidth deprecated int height display.getHeight deprecated For the use case you're..
How to use the gridlayout to fit screen size http://stackoverflow.com/questions/10347846/how-to-use-the-gridlayout-to-fit-screen-size dimensions. Below a very quick 'n dirty approximation of the tiled layout in the Google Play app. Point size new Point getWindowManager .getDefaultDisplay .getSize size int screenWidth size.x int screenHeight size.y int halfScreenWidth int screenWidth 0.5..
Android Drag and drop images on the Screen? http://stackoverflow.com/questions/11027792/android-drag-and-drop-images-on-the-screen void onCreate Bundle savedInstanceState super.onCreate savedInstanceState setContentView R.layout.main windowwidth getWindowManager .getDefaultDisplay .getWidth windowheight getWindowManager .getDefaultDisplay .getHeight System.out.println width windowwidth.. savedInstanceState setContentView R.layout.main windowwidth getWindowManager .getDefaultDisplay .getWidth windowheight getWindowManager .getDefaultDisplay .getHeight System.out.println width windowwidth System.out.println height windowheight ima1 ImageView.. android drag and drop imageview share improve this question Write Below Code into your Activity File. windowwidth getWindowManager .getDefaultDisplay .getWidth windowheight getWindowManager .getDefaultDisplay .getHeight tv1 ImageView findViewById R.id.image..
Detect 7 inch and 10 inch tablet programmatically http://stackoverflow.com/questions/15055458/detect-7-inch-and-10-inch-tablet-programmatically that your app is running on. First we create a DisplayMetrics metrics object DisplayMetrics metrics new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics metrics From this we can get the information required to size the display int widthPixels..
Is there a way to determine android physical screen height in cm or inches? http://stackoverflow.com/questions/2193457/is-there-a-way-to-determine-android-physical-screen-height-in-cm-or-inches screen resolution inches share improve this question Use the following DisplayMetrics dm new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics dm double x Math.pow dm.widthPixels dm.xdpi 2 double y Math.pow dm.heightPixels dm.ydpi 2..
How to layout text to flow around an image http://stackoverflow.com/questions/2248759/how-to-layout-text-to-flow-around-an-image TextView messageView TextView findViewById R.id.message_view String text getString R.string.text Display display getWindowManager .getDefaultDisplay FlowTextHelper.tryFlowText text thumbnailView messageView display This is how the application looks on..
Android - LinearLayout Horizontal with wrapping children http://stackoverflow.com/questions/2961777/android-linearlayout-horizontal-with-wrapping-children this kind of behaviour private void populateLinks LinearLayout ll ArrayList collection String header Display display getWindowManager .getDefaultDisplay int maxWidth display.getWidth 10 if collection.size 0 LinearLayout llAlso new LinearLayout this llAlso.setLayoutParams..
Size of android notification bar and title bar? http://stackoverflow.com/questions/3600713/size-of-android-notification-bar-and-title-bar of the notification bar and title bar in android At the moment I obtain display width and height with Display display getWindowManager .getDefaultDisplay int width display.getWidth int height display.getHeight After that I want to subtract the sizes of the.. you know which value to subtract so it could look something like that DisplayMetrics metrics new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics metrics int myHeight 0 switch metrics.densityDpi case DisplayMetrics.DENSITY_HIGH Log.i display..
Touch and drag image in android http://stackoverflow.com/questions/4255859/touch-and-drag-image-in-android extends Activity @Override protected void onCreate Bundle savedInstanceState super.onCreate savedInstanceState int w getWindowManager .getDefaultDisplay .getWidth 25 int h getWindowManager .getDefaultDisplay .getHeight 25 BallView ballView new BallView this.. savedInstanceState super.onCreate savedInstanceState int w getWindowManager .getDefaultDisplay .getWidth 25 int h getWindowManager .getDefaultDisplay .getHeight 25 BallView ballView new BallView this w h setContentView ballView public class BallView extends..
Android: Showing wrong screen resolution http://stackoverflow.com/questions/5078808/android-showing-wrong-screen-resolution I was trying to get the screen resolution of android phones using this code DisplayMetrics dm new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics dm str_ScreenSize dm.widthPixels x dm.heightPixels str_ScreenSize dd x dm.heightPixels When..
Screen orientation lock http://stackoverflow.com/questions/6599770/screen-orientation-lock if mScreenOrientationLocked final int orientation getResources .getConfiguration .orientation final int rotation getWindowManager .getDefaultDisplay .getOrientation if rotation Surface.ROTATION_0 rotation Surface.ROTATION_90 if orientation Configuration.ORIENTATION_PORTRAIT.. setRequestedOrientation ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else int rotation getWindowManager .getDefaultDisplay .getRotation if rotation android.view.Surface.ROTATION_90 rotation android.view.Surface.ROTATION_180.. setRequestedOrientation ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE else int rotation getWindowManager .getDefaultDisplay .getRotation if rotation android.view.Surface.ROTATION_0 rotation android.view.Surface.ROTATION_90 ..
Determine if the device is a smartphone or tablet? http://stackoverflow.com/questions/9279111/determine-if-the-device-is-a-smartphone-or-tablet seems useless for my case this solution work for me now DisplayMetrics metrics new DisplayMetrics getWindowManager .getDefaultDisplay .getMetrics metrics int width metrics.widthPixels int height metrics.heightPixels if SharedCode.width..
|