android.view.Window.setCallback()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(65)

本文整理了Java中android.view.Window.setCallback()方法的一些代码示例,展示了Window.setCallback()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.setCallback()方法的具体详情如下:
包路径:android.view.Window
类名称:Window
方法名:setCallback

Window.setCallback介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

mWindow.setCallback(new AppCompatWindowCallbackCustom(mOriginalWindowCallback, activity));
} catch (NoSuchFieldException e) {
  e.printStackTrace();

代码示例来源:origin: pchmn/MaterialChipsInput

activity.getWindow().setCallback(new MyWindowCallback(mCallBack, activity));

代码示例来源:origin: stackoverflow.com

//set Window.Callback for getting touch event
   final Window win = context.getWindow();
   final Window.Callback localCallback = win.getCallback();
   win.setCallback(new MyWindowCallback(localCallback));

代码示例来源:origin: baidu/GPT

/**
 * 替换WindowCallback
 *
 * @param activity Activity
 */
public static void replaceWindowCallback(Activity activity) {
  activity.getWindow().setCallback(activity);
  Window.Callback callback = activity.getWindow().getCallback();
  WindowCallbackWorker callbackWorker = new WindowCallbackWorker();
  callbackWorker.mTarget = callback;
  callbackWorker.mActivity = activity;
  activity.getWindow().setCallback(callbackWorker);
}

代码示例来源:origin: stackoverflow.com

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  try {
    Field mDelegateField = AppCompatActivity.class.getDeclaredField("mDelegate");
    mDelegateField.setAccessible(true);
    Object mDelegate = mDelegateField.get(this);

    Field mWindowField = mDelegate.getClass().getSuperclass().getSuperclass().getDeclaredField("mWindow");
    mWindowField.setAccessible(true);
    Window mWindow = (Window) mWindowField.get(mDelegate);

    Window.Callback mOriginalWindowCallback = mWindow.getCallback();
    mWindow.setCallback(new AppCompatWindowCallbackCustom(mOriginalWindowCallback));
  } catch (NoSuchFieldException e) {
    e.printStackTrace();
  } catch (IllegalAccessException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: stackoverflow.com

Dialog(Context context, int theme, boolean createContextWrapper) {
 if (theme == 0) {
   TypedValue outValue = new TypedValue();
   context.getTheme().resolveAttribute(com.android.internal.R.attr.dialogTheme,
       outValue, true);
   theme = outValue.resourceId;
 }
 mContext = createContextWrapper ? new ContextThemeWrapper(context, theme) : context;
 mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
 Window w = PolicyManager.makeNewWindow(mContext);
 mWindow = w;
 w.setCallback(this);
 w.setWindowManager(mWindowManager, null, null);
 w.setGravity(Gravity.CENTER);
 mUiThread = Thread.currentThread();
 mListenersHandler = new ListenersHandler(this);
 }

代码示例来源:origin: stackoverflow.com

Dialog(Context context, int theme, boolean createContextThemeWrapper) {
  if (createContextThemeWrapper) {
    if (theme == 0) {
      TypedValue outValue = new TypedValue();
      context.getTheme().resolveAttribute(com.android.internal.R.attr.dialogTheme,
          outValue, true);
      theme = outValue.resourceId;
    }
    mContext = new ContextThemeWrapper(context, theme);
  } else {
    mContext = context;
  }

  mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  Window w = PolicyManager.makeNewWindow(mContext);
  mWindow = w;
  w.setCallback(this);
  w.setOnWindowDismissedCallback(this);
  w.setWindowManager(mWindowManager, null, null);
  w.setGravity(Gravity.CENTER);
  mListenersHandler = new ListenersHandler(this);
}

代码示例来源:origin: iqiyi/Neptune

mPlugin.getWindow().setCallback(mPlugin);

相关文章

微信公众号

最新文章

更多

Window类方法