当前位置: 首页>>代码示例>>Java>>正文


Java Display.getRealSize方法代码示例

本文整理汇总了Java中android.view.Display.getRealSize方法的典型用法代码示例。如果您正苦于以下问题:Java Display.getRealSize方法的具体用法?Java Display.getRealSize怎么用?Java Display.getRealSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.Display的用法示例。


在下文中一共展示了Display.getRealSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setWindowDecorations

import android.view.Display; //导入方法依赖的package包/类
public static void setWindowDecorations(Activity activity, SharedPreferences options) {
	if (Build.VERSION.SDK_INT >= 21) {
		activity.getWindow().setStatusBarColor(options.getInt(Keys.STATUS_BAR_BACKGROUND, 0x22000000));
		activity.getWindow().setNavigationBarColor(options.getInt(Keys.NAV_BAR_BACKGROUND, 0x22000000));
	} else {
		activity.findViewById(R.id.dummy_top_view).setBackgroundColor(options.getInt(Keys.BAR_BACKGROUND, 0x22000000));
		Display display = ((WindowManager)activity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
		Point size = new Point();
		Point realSize = new Point();
		display.getSize(size);
		display.getRealSize(realSize);
		int navBarHeight = size.y-realSize.y;
		View dummyBottomView = activity.findViewById(R.id.dummy_bottom_view);
		ViewGroup.LayoutParams p = dummyBottomView.getLayoutParams();
		p.height = navBarHeight;
		dummyBottomView.setLayoutParams(p);
		if (navBarHeight > 0) {
			dummyBottomView.setVisibility(View.VISIBLE);
			dummyBottomView.setBackgroundColor(options.getInt(Keys.NAV_BAR_BACKGROUND, 0x22000000));
		}
	}
}
 
开发者ID:HenriDellal,项目名称:emerald,代码行数:23,代码来源:Themer.java

示例2: getResolution

import android.view.Display; //导入方法依赖的package包/类
/**
 * @return 获取屏幕分辨率
 */
public static Point getResolution(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    DisplayMetrics outMetrics = new DisplayMetrics();
    Display display = wm.getDefaultDisplay();
    display.getMetrics(outMetrics);

    Point point = new Point();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        display.getRealSize(point);
    } else {
        point.x = outMetrics.widthPixels;
        point.y = outMetrics.heightPixels;
    }
    return point;
}
 
开发者ID:jiajieshen,项目名称:AndroidDevSamples,代码行数:19,代码来源:ScreenUtil.java

示例3: isNavigationBarShow

import android.view.Display; //导入方法依赖的package包/类
public static boolean isNavigationBarShow(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Point size = new Point();
        Point realSize = new Point();
        display.getSize(size);
        display.getRealSize(realSize);
        return realSize.y != size.y;
    } else {
        boolean menu = ViewConfiguration.get(activity).hasPermanentMenuKey();
        boolean back = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
        if (menu || back) {
            return false;
        } else {
            return true;
        }
    }
}
 
开发者ID:mmjang,项目名称:ankihelper,代码行数:19,代码来源:ViewUtil.java

示例4: setCustomNotifBgLandscape

import android.view.Display; //导入方法依赖的package包/类
private void setCustomNotifBgLandscape() {
    Display display = getActivity().getWindowManager().getDefaultDisplay();
    Point displaySize = new Point();
    display.getRealSize(displaySize);
    Intent intent = new Intent(getActivity(), PickImageActivity.class);
    intent.putExtra(PickImageActivity.EXTRA_CROP, true);
    boolean isPortrait = getResources()
            .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
    intent.putExtra(PickImageActivity.EXTRA_ASPECT_X, isPortrait ? displaySize.y : displaySize.x);
    intent.putExtra(PickImageActivity.EXTRA_ASPECT_Y, isPortrait ? displaySize.x : displaySize.y);
    intent.putExtra(PickImageActivity.EXTRA_OUTPUT_X, isPortrait ? displaySize.y : displaySize.x);
    intent.putExtra(PickImageActivity.EXTRA_OUTPUT_Y, isPortrait ? displaySize.x : displaySize.y);
    intent.putExtra(PickImageActivity.EXTRA_SCALE, true);
    intent.putExtra(PickImageActivity.EXTRA_SCALE_UP, true);
    startActivityForResult(intent, REQ_NOTIF_BG_IMAGE_LANDSCAPE);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:17,代码来源:GravityBoxSettings.java

示例5: b

import android.view.Display; //导入方法依赖的package包/类
@SuppressLint({"NewApi"})
public static Point b() {
    Display defaultDisplay = ((WindowManager) hn.a().c().getSystemService("window")).getDefaultDisplay();
    Point point = new Point();
    if (VERSION.SDK_INT >= 17) {
        defaultDisplay.getRealSize(point);
    } else if (VERSION.SDK_INT >= 14) {
        try {
            Method method = Display.class.getMethod("getRawHeight", new Class[0]);
            point.x = ((Integer) Display.class.getMethod("getRawWidth", new Class[0]).invoke(defaultDisplay, new Object[0])).intValue();
            point.y = ((Integer) method.invoke(defaultDisplay, new Object[0])).intValue();
        } catch (Throwable th) {
            defaultDisplay.getSize(point);
        }
    } else if (VERSION.SDK_INT >= 13) {
        defaultDisplay.getSize(point);
    } else {
        point.x = defaultDisplay.getWidth();
        point.y = defaultDisplay.getHeight();
    }
    return point;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:23,代码来源:jl.java

示例6: getRealScreenSize

import android.view.Display; //导入方法依赖的package包/类
public static Point getRealScreenSize(Context context) {
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    Point size = new Point();

    if (Build.VERSION.SDK_INT >= 17) {
        display.getRealSize(size);
    } else {
        try {
            size.x = (Integer) Display.class.getMethod("getRawWidth").invoke(display);
            size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    return size;
}
 
开发者ID:qiujuer,项目名称:AirPanel,代码行数:19,代码来源:MainActivity.java

示例7: getRealScreenSize

import android.view.Display; //导入方法依赖的package包/类
private static Point getRealScreenSize(@NonNull Context context) {
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    Point size = new Point();

    if (Build.VERSION.SDK_INT >= 17) {
        display.getRealSize(size);
    } else if (Build.VERSION.SDK_INT >= 14) {
        try {
            size.x = (Integer)     Display.class.getMethod("getRawWidth").invoke(display);
            size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display);
        } catch (Exception e) {
            LogUtil.e(Log.getStackTraceString(e));
        }
    }
    return size;
}
 
开发者ID:danimahardhika,项目名称:cafebar,代码行数:18,代码来源:CafeBarUtil.java

示例8: NaskhPageProvider

import android.view.Display; //导入方法依赖的package包/类
public NaskhPageProvider(@NonNull Display display) {
  final Point point = new Point();
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    display.getRealSize(point);
  } else {
    try {
      // getRealSize was actually present since 4.0, but was annotated @hide.
      Display.class.getMethod("getRealSize", Point.class).invoke(display, point);
    } catch (Exception e) {
      display.getSize(point);
    }
  }

  mRatioIndex = getScreenRatioIndex(point.x, point.y);
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:16,代码来源:NaskhPageProvider.java

示例9: getScreenHeightWidth

import android.view.Display; //导入方法依赖的package包/类
public static Point getScreenHeightWidth(WindowManager mWindowManager) {
    Point point = new Point();
    try {
        Display display = mWindowManager.getDefaultDisplay();
        if (VERSION.SDK_INT >= 17) {
            display.getRealSize(point);
        } else {
            point.y = display.getHeight();
            point.x = display.getWidth();
        }
    } catch (Throwable e) {
        LOG.w(TAG, "getScreenHeightWidth failed(Throwable): " + e.getMessage());
    }
    return point;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:16,代码来源:SDKUtils.java

示例10: getWidth

import android.view.Display; //导入方法依赖的package包/类
public static int getWidth(Context context) {
    WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Point size = new Point();
    Display display = manager.getDefaultDisplay();
    display.getRealSize(size);

    return size.x;
}
 
开发者ID:Assassinss,项目名称:Moment,代码行数:9,代码来源:ScreenUtils.java

示例11: updateSubsSize

import android.view.Display; //导入方法依赖的package包/类
public void updateSubsSize(){
    if(mSize>=0) {
        Display display = mWindowManager.getDefaultDisplay();
        Point point = new Point();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
            display.getRealSize(point);
        display.getSize(point);
        int size = (int) ((mParamsF.width / (float)(point.y<point.x ?point.x:point.y)) * mSize);
        int vpos = (int) ((mParamsF.height / (float)(point.y<point.x ?point.y:point.x)) * mVPos);
        mSubtitleManager.setSize(size);
        mSubtitleManager.setVerticalPosition(vpos);
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:14,代码来源:FloatingPlayerService.java

示例12: setUpVirtualDisplay

import android.view.Display; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setUpVirtualDisplay() {

    mScreen = (ViewGroup) getActivity().getWindow().getDecorView().getRootView();

    // display metrics
    DisplayMetrics metrics = getResources().getDisplayMetrics();
    mDensity = metrics.densityDpi;
    Display mDisplay = getActivity().getWindowManager().getDefaultDisplay();

    Point size = new Point();
    mDisplay.getRealSize(size);
    mWidth = size.x;
    mHeight = size.y;

    // start capture reader
    mImageReader = ImageReader.newInstance(mWidth, mHeight, PixelFormat.RGBA_8888, 2);
    int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR;

    mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture", mWidth, mHeight, mDensity, flags, mImageReader.getSurface(), null, null);

    size.set(mWidth, mHeight);

    //create ScreenCapturer
    mScreenCapturer = new ScreenSharingCapturer(getActivity(), mScreen, mImageReader);

    mListener.onScreenCapturerReady();
}
 
开发者ID:opentok,项目名称:accelerator-core-android,代码行数:29,代码来源:ScreenSharingFragment.java

示例13: getRealScreenSize

import android.view.Display; //导入方法依赖的package包/类
private static Point getRealScreenSize(Context context) {
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    Point size = new Point();
    display.getRealSize(size);
    return size;
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:8,代码来源:Measure.java

示例14: getRealSize

import android.view.Display; //导入方法依赖的package包/类
public static void getRealSize(Display display, Point outSize) {
  display.getRealSize(outSize);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:4,代码来源:JellybeanUtil.java

示例15: getDisplaySizeV17

import android.view.Display; //导入方法依赖的package包/类
@TargetApi(17)
private static void getDisplaySizeV17(Display display, Point outSize) {
  display.getRealSize(outSize);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:5,代码来源:VideoFormatSelectorUtil.java


注:本文中的android.view.Display.getRealSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。