3/16/2023 0 Comments Xamarin windowmanager![]() ![]() GetWindowManager().getDefaultDisplay().getMetrics(metrics) To access the DisplayMetrics members, initialize an object like this: DisplayMetrics metrics = new DisplayMetrics() Int height = display.getHeight() // deprecatedįor the use case, you're describing, however, a margin/padding in the layout seems more appropriate.Ī structure describing general information about a display, such as its size, density, and font scaling. Int width = display.getWidth() // deprecated If you are in a fragment and want to acomplish this just use Activity.WindowManager (in Xamarin.Android) or getActivity().getWindowManager() (in java).īefore getSize was introduced (in API level 13), you could use the getWidth and getHeight methods that are now deprecated: Display display = getWindowManager().getDefaultDisplay() ![]() If you're not in an Activity you can get the default Display via WINDOW_SERVICE: WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE) ĭisplay display = wm.getDefaultDisplay() If you want the display dimensions in pixels you can use getSize: Display display = getWindowManager().getDefaultDisplay() I'm not sure what else I would need to do to get the theme to take in the app. Then I added it to my AndroidManifest.xml I've also created one for older versions and put it in I've created a custom theme for Holo and put it in I'm trying to get my app to use the Holo.Light theme. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |