本文整理汇总了Java中android.view.Window.isFloating方法的典型用法代码示例。如果您正苦于以下问题:Java Window.isFloating方法的具体用法?Java Window.isFloating怎么用?Java Window.isFloating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.Window
的用法示例。
在下文中一共展示了Window.isFloating方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustDialogSizeForLargeScreen
import android.view.Window; //导入方法依赖的package包/类
/**
* Uses a fixed size for {@code window} in large screens.
*
* @param dialogWindow
* the window <i>of the dialog</i>.
*/
public static void adjustDialogSizeForLargeScreen(Window dialogWindow) {
if (BuildConfig.DEBUG)
Log.d(CLASSNAME, "adjustDialogSizeForLargeScreen()");
if (dialogWindow.isFloating()
&& dialogWindow.getContext().getResources()
.getBoolean(R.bool.afc_is_large_screen)) {
final DisplayMetrics metrics = dialogWindow.getContext()
.getResources().getDisplayMetrics();
final boolean isPortrait = metrics.widthPixels < metrics.heightPixels;
int width = metrics.widthPixels;// dialogWindow.getDecorView().getWidth();
int height = metrics.heightPixels;// dialogWindow.getDecorView().getHeight();
if (BuildConfig.DEBUG)
Log.d(CLASSNAME, String.format("width = %,d | height = %,d",
width, height));
width = (int) dialogWindow
.getContext()
.getResources()
.getFraction(
isPortrait ? R.dimen.aosp_dialog_fixed_width_minor
: R.dimen.aosp_dialog_fixed_width_major,
width, width);
height = (int) dialogWindow
.getContext()
.getResources()
.getFraction(
isPortrait ? R.dimen.aosp_dialog_fixed_height_major
: R.dimen.aosp_dialog_fixed_height_minor,
height, height);
if (BuildConfig.DEBUG)
Log.d(CLASSNAME, String.format(
"NEW >>> width = %,d | height = %,d", width, height));
dialogWindow.setLayout(width, height);
}
}