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

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

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

Window.getCallback介绍

暂无

代码示例

代码示例来源:origin: RobotiumTech/robotium

activity.getWindow().getCallback().onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, homeMenuItem);
}catch(Exception ignored) {}

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

Window mWindow = (Window) mWindowField.get(mDelegate);
  Window.Callback mOriginalWindowCallback = mWindow.getCallback();
  mWindow.setCallback(new AppCompatWindowCallbackCustom(mOriginalWindowCallback, activity));
} catch (NoSuchFieldException e) {

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

throw new ClassCastException("android.view.Context cannot be cast to android.app.Activity");
android.view.Window.Callback mCallBack = (activity).getWindow().getCallback();
activity.getWindow().setCallback(new MyWindowCallback(mCallBack, activity));

代码示例来源:origin: limpoxe/Android-Plugin-Framework

public PluginViewFactory(Activity context, Window window, LayoutInflater.Factory viewfactory) {
  mContext = context;
  mWindow = window;
  mOriginalWindowCallback = window.getCallback();
  mViewfactory = viewfactory;
}

代码示例来源: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: 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: 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: com.willowtreeapps/oak-demos

@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
  if (DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);
  if (mContentParent == null) {
    installDecor();
  } else {
    mContentParent.removeAllViews();
  }
  mContentParent.addView(view, params);
  android.view.Window.Callback callback = mActivity.getWindow().getCallback();
  if (callback != null) {
    callback.onContentChanged();
  }
  initActionBar();
}

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
  if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);
  if (mContentParent == null) {
    installDecor();
  } else {
    mContentParent.removeAllViews();
  }
  mContentParent.addView(view, params);
  android.view.Window.Callback callback = mActivity.getWindow().getCallback();
  if (callback != null) {
    callback.onContentChanged();
  }
  initActionBar();
}

代码示例来源:origin: com.jayway.android.robotium/robotium-solo

activity.getWindow().getCallback().onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, homeMenuItem);
}catch(Exception ignored) {}

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public void setContentView(int layoutResId) {
  if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] layoutResId: " + layoutResId);
  if (mContentParent == null) {
    installDecor();
  } else {
    mContentParent.removeAllViews();
  }
  mActivity.getLayoutInflater().inflate(layoutResId, mContentParent);
  android.view.Window.Callback callback = mActivity.getWindow().getCallback();
  if (callback != null) {
    callback.onContentChanged();
  }
  initActionBar();
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public void setContentView(int layoutResId) {
  if (DEBUG) Log.d(TAG, "[setContentView] layoutResId: " + layoutResId);
  if (mContentParent == null) {
    installDecor();
  } else {
    mContentParent.removeAllViews();
  }
  mActivity.getLayoutInflater().inflate(layoutResId, mContentParent);
  android.view.Window.Callback callback = mActivity.getWindow().getCallback();
  if (callback != null) {
    callback.onContentChanged();
  }
  initActionBar();
}

相关文章

Window类方法