本文整理了Java中android.view.Window.peekDecorView()
方法的一些代码示例,展示了Window.peekDecorView()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.peekDecorView()
方法的具体详情如下:
包路径:android.view.Window
类名称:Window
方法名:peekDecorView
暂无
代码示例来源:origin: facebook/stetho
@Override
@Nullable
public View getViewAndBoundsForHighlighting(Window element, Rect bounds) {
return element.peekDecorView();
}
代码示例来源:origin: facebook/stetho
@Override
protected void onGetChildren(Window element, Accumulator<Object> children) {
View decorView = element.peekDecorView();
if (decorView != null) {
children.store(decorView);
}
}
代码示例来源:origin: bingoogolapple/BGASwipeBackLayout-Android
/**
* 关闭activity中打开的键盘
*
* @param activity
*/
public static void closeKeyboard(Activity activity) {
View view = activity.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: facebook/stetho
@Override
public void store(Window object) {
if (object.peekDecorView() instanceof ViewGroup) {
final ViewGroup decorView = (ViewGroup) object.peekDecorView();
OverlayView overlayView = new OverlayView(mApplication);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
decorView.addView(overlayView, layoutParams);
decorView.bringChildToFront(overlayView);
mOverlays.add(overlayView);
}
}
});
代码示例来源:origin: bingoogolapple/BGASwipeBackLayout-Android
/**
* 关闭dialog中打开的键盘
*
* @param dialog
*/
public static void closeKeyboard(Dialog dialog) {
View view = dialog.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputMethodManager = (InputMethodManager) dialog.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: facebook/stetho
@Nullable
@Override
public Object getElementToHighlightAtPosition(Window element, int x, int y, Rect bounds) {
final Descriptor.Host host = getHost();
View view = null;
HighlightableDescriptor descriptor = null;
if (host instanceof AndroidDescriptorHost) {
view = element.peekDecorView();
descriptor = ((AndroidDescriptorHost) host).getHighlightableDescriptor(view);
}
return descriptor == null
? null
: descriptor.getElementToHighlightAtPosition(view, x, y, bounds);
}
}
代码示例来源:origin: GcsSloop/diycode
View decorView = activity.getWindow().peekDecorView();
boolean windowAttached = decorView.getWindowVisibility() != View.GONE;
if (!windowAttached) {
代码示例来源:origin: GuoFeilong/LifeHelper
/**
* 关闭软件盘
*/
public static void closeSoftKeyboard(Activity activity) {
View view = activity.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputmanger = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: szpnygo/NoWordsChat
public static void closeKeyMap(Activity activity) {
View view = activity.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputmanger = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: AliEsaAssadi/android-mvvm-sample-app
public static void hideSoftKeyboard(Activity activity) {
View view = activity.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputmanger = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: enricocid/LaunchEnr
public static void closeKeyboard(Activity activity) {
final View v = activity.getWindow().peekDecorView();
if (v != null && v.getWindowToken() != null) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(
INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
代码示例来源:origin: AliEsaAssadi/Android-MVP-Architecture
public static void hideSoftKeyboard(Activity activity) {
View view = activity.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputmanger = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: Hankkin/TaoSchool
/**
* 隐藏软键盘
*/
public static void hideSoftInputMethod(Activity act) {
View view = act.getWindow().peekDecorView();
if (view != null) {
// 隐藏虚拟键盘
InputMethodManager inputmanger = (InputMethodManager) act
.getSystemService(act.INPUT_METHOD_SERVICE);
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: TongmingWu/Manga
public static void hideSoftInput(Activity activity) {
View view = activity.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputmanger = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: xiaolongonly/Ticket-Analysis
/**
* 动态隐藏软键盘
*/
public static void hideSoftInput(Activity activity) {
View view = activity.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputmanger = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: kaixuanluo/pc-android-controller-android
private void closeKeyboard(Activity context) {
View view = context.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
}
代码示例来源:origin: AriesHoo/UIWidget
/**
* 关闭activity中打开的键盘
*
* @param activity
*/
public static void closeKeyboard(Activity activity) {
View view = activity.getWindow().peekDecorView();
closeKeyboard(view);
}
代码示例来源:origin: Meiqia/MeiqiaSDK-Android
/**
* 关闭dialog中打开的键盘
*
* @param dialog
*/
public static void closeKeyboard(Dialog dialog) {
View view = dialog.getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputMethodManager = (InputMethodManager) dialog.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
代码示例来源:origin: AriesHoo/UIWidget
/**
* 关闭dialog中打开的键盘
*
* @param dialog
*/
public static void closeKeyboard(Dialog dialog) {
View view = dialog.getWindow().peekDecorView();
closeKeyboard(view);
}
代码示例来源:origin: kingargyle/adt-leanback-support
@Override
public boolean hasView() {
Window window = FragmentActivity.this.getWindow();
return (window != null && window.peekDecorView() != null);
}
};
内容来源于网络,如有侵权,请联系作者删除!