View的mParent变量初始化

2023-05-16

mParent变量实际上是PhoneWindow$DecorView类型,是所有应用窗口的根视图 , 是FrameLayout的子类  

View的requestLayout()函数也是调用了mParent.requestLayout();


mParent不是在View里面进行赋值

因为View里面只有assignParent对其进行了赋值,而View里面没有调用这个方法

void assignParent(ViewParent parent) {
        if (mParent == null) {
            mParent = parent;
        } else if (parent == null) {
            mParent = null;
        } else {
            throw new RuntimeException("view " + this + " being added, but"
                    + " it already has a parent");
        }
}

实际上是在Activity的启动过程赋值的

启动actiity要调用startActivity(); startActivity分为多种在Launcher点击app和在activity中的跳转,最后都会调用ActivityThread的performLaunchActivity函数

private Activity performLaunchActivity(ActivityClientRecord r, Intent customIntent) {
        // System.out.println("##### [" + System.currentTimeMillis() + "] ActivityThread.performLaunchActivity(" + r + ")");

        ActivityInfo aInfo = r.activityInfo;
        if (r.packageInfo == null) {
            r.packageInfo = getPackageInfo(aInfo.applicationInfo, r.compatInfo,
                    Context.CONTEXT_INCLUDE_CODE);
        }

        ComponentName component = r.intent.getComponent();
        if (component == null) {
            component = r.intent.resolveActivity(
                mInitialApplication.getPackageManager());
            r.intent.setComponent(component);
        }

        if (r.activityInfo.targetActivity != null) {
            component = new ComponentName(r.activityInfo.packageName,
                    r.activityInfo.targetActivity);
        }

        Activity activity = null;
        try {
            java.lang.ClassLoader cl = r.packageInfo.getClassLoader();
            activity = mInstrumentation.newActivity(
                    cl, component.getClassName(), r.intent);
            StrictMode.incrementExpectedActivityCount(activity.getClass());
            r.intent.setExtrasClassLoader(cl);
            r.intent.prepareToEnterProcess();
            if (r.state != null) {
                r.state.setClassLoader(cl);
            }
        } catch (Exception e) {
            if (!mInstrumentation.onException(activity, e)) {
                throw new RuntimeException(
                    "Unable to instantiate activity " + component
                    + ": " + e.toString(), e);
            }
        }

        try {
            Application app = r.packageInfo.makeApplication(false, mInstrumentation);

            if (localLOGV) Slog.v(TAG, "Performing launch of " + r);
            if (localLOGV) Slog.v(
                    TAG, r + ": app=" + app
                    + ", appName=" + app.getPackageName()
                    + ", pkg=" + r.packageInfo.getPackageName()
                    + ", comp=" + r.intent.getComponent().toShortString()
                    + ", dir=" + r.packageInfo.getAppDir());

            if (activity != null) {
                Context appContext = createBaseContextForActivity(r, activity);
                CharSequence title = r.activityInfo.loadLabel(appContext.getPackageManager());
                Configuration config = new Configuration(mCompatConfiguration);
                if (DEBUG_CONFIGURATION) Slog.v(TAG, "Launching activity "
                        + r.activityInfo.name + " with config " + config);
                activity.attach(appContext, this, getInstrumentation(), r.token,
                        r.ident, app, r.intent, r.activityInfo, title, r.parent,
                        r.embeddedID, r.lastNonConfigurationInstances, config,
                        r.voiceInteractor);

                if (customIntent != null) {
                    activity.mIntent = customIntent;
                }
                r.lastNonConfigurationInstances = null;
                activity.mStartedActivity = false;
                int theme = r.activityInfo.getThemeResource();
                if (theme != 0) {
                    activity.setTheme(theme);
                }

                activity.mCalled = false;
                if (r.isPersistable()) {
                    mInstrumentation.callActivityOnCreate(activity, r.state, r.persistentState);
                } else {
                    mInstrumentation.callActivityOnCreate(activity, r.state);
                }
                if (!activity.mCalled) {
                    throw new SuperNotCalledException(
                        "Activity " + r.intent.getComponent().toShortString() +
                        " did not call through to super.onCreate()");
                }
                r.activity = activity;
                r.stopped = true;
                if (!r.activity.mFinished) {
                    activity.performStart();
                    r.stopped = false;
                }
                if (!r.activity.mFinished) {
                    if (r.isPersistable()) {
                        if (r.state != null || r.persistentState != null) {
                            mInstrumentation.callActivityOnRestoreInstanceState(activity, r.state,
                                    r.persistentState);
                        }
                    } else if (r.state != null) {
                        mInstrumentation.callActivityOnRestoreInstanceState(activity, r.state);
                    }
                }
                if (!r.activity.mFinished) {
                    activity.mCalled = false;
                    if (r.isPersistable()) {
                        mInstrumentation.callActivityOnPostCreate(activity, r.state,
                                r.persistentState);
                    } else {
                        mInstrumentation.callActivityOnPostCreate(activity, r.state);
                    }
                    if (!activity.mCalled) {
                        throw new SuperNotCalledException(
                            "Activity " + r.intent.getComponent().toShortString() +
                            " did not call through to super.onPostCreate()");
                    }
                }
            }
            r.paused = true;

            mActivities.put(r.token, r);

        } catch (SuperNotCalledException e) {
            throw e;

        } catch (Exception e) {
            if (!mInstrumentation.onException(activity, e)) {
                throw new RuntimeException(
                    "Unable to start activity " + component
                    + ": " + e.toString(), e);
            }
        }

        return activity;
    }
调用了Instrumentation类的callActivityOnCreate函数

public void callActivityOnCreate(Activity activity, Bundle icicle) {
        prePerformCreate(activity);
        activity.performCreate(icicle);
        postPerformCreate(activity);
    }
调用了Activity的performCreate函数

final void performCreate(Bundle icicle) {
        onCreate(icicle);
        mActivityTransitionState.readState(icicle);
        performCreateCommon();
    }
调用了Activity的onCreate函数

在继承的onCreate函数中通常有setContentView函数

实际上就是调用了PhoneWindow的setContentView

 @Override
    public void setContentView(int layoutResID) {
        // Note: FEATURE_CONTENT_TRANSITIONS may be set in the process of installing the window
        // decor, when theme attributes and the like are crystalized. Do not check the feature
        // before this happens.
        if (mContentParent == null) {
            installDecor();
        } else if (!hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
            mContentParent.removeAllViews();
        }

        if (hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
            final Scene newScene = Scene.getSceneForLayout(mContentParent, layoutResID,
                    getContext());
            transitionTo(newScene);
        } else {
            mLayoutInflater.inflate(layoutResID, mContentParent);
        }
        final Callback cb = getCallback();
        if (cb != null && !isDestroyed()) {
            cb.onContentChanged();
        }
    }
里面调用了installDecor进行Decor的初始化

接下来是要把这个Decor赋值给View的mParent进行赋值

 private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent) {
        // If we are getting ready to gc after going to the background, well
        // we are back active so skip it.
        unscheduleGcIdler();
        mSomeActivitiesChanged = true;

        if (r.profilerInfo != null) {
            mProfiler.setProfiler(r.profilerInfo);
            mProfiler.startProfiling();
        }

        // Make sure we are running with the most recent config.
        handleConfigurationChanged(null, null);

        if (localLOGV) Slog.v(
            TAG, "Handling launch of " + r);

        Activity a = performLaunchActivity(r, customIntent);

        if (a != null) {
            r.createdConfig = new Configuration(mConfiguration);
            Bundle oldState = r.state;
            handleResumeActivity(r.token, false, r.isForward,
                    !r.activity.mFinished && !r.startsNotResumed);

            if (!r.activity.mFinished && r.startsNotResumed) {
                // The activity manager actually wants this one to start out
                // paused, because it needs to be visible but isn't in the
                // foreground.  We accomplish this by going through the
                // normal startup (because activities expect to go through
                // onResume() the first time they run, before their window
                // is displayed), and then pausing it.  However, in this case
                // we do -not- need to do the full pause cycle (of freezing
                // and such) because the activity manager assumes it can just
                // retain the current state it has.
                try {
                    r.activity.mCalled = false;
                    mInstrumentation.callActivityOnPause(r.activity);
                    // We need to keep around the original state, in case
                    // we need to be created again.  But we only do this
                    // for pre-Honeycomb apps, which always save their state
                    // when pausing, so we can not have them save their state
                    // when restarting from a paused state.  For HC and later,
                    // we want to (and can) let the state be saved as the normal
                    // part of stopping the activity.
                    if (r.isPreHoneycomb()) {
                        r.state = oldState;
                    }
                    if (!r.activity.mCalled) {
                        throw new SuperNotCalledException(
                            "Activity " + r.intent.getComponent().toShortString() +
                            " did not call through to super.onPause()");
                    }

                } catch (SuperNotCalledException e) {
                    throw e;

                } catch (Exception e) {
                    if (!mInstrumentation.onException(r.activity, e)) {
                        throw new RuntimeException(
                                "Unable to pause activity "
                                + r.intent.getComponent().toShortString()
                                + ": " + e.toString(), e);
                    }
                }
                r.paused = true;
            }
        } else {
            // If there was an error, for any reason, tell the activity
            // manager to stop us.
            try {
                ActivityManagerNative.getDefault()
                    .finishActivity(r.token, Activity.RESULT_CANCELED, null, false);
            } catch (RemoteException ex) {
                // Ignore
            }
        }
    }
handleLaunchActivity显示调用了performLaunchActivity,然后调用了handleResumeActivity

handleResumeActivity

final void handleResumeActivity(IBinder token,
            boolean clearHide, boolean isForward, boolean reallyResume) {
        // If we are getting ready to gc after going to the background, well
        // we are back active so skip it.
        unscheduleGcIdler();
        mSomeActivitiesChanged = true;

        // TODO Push resumeArgs into the activity for consideration
        ActivityClientRecord r = performResumeActivity(token, clearHide);

        if (r != null) {
            final Activity a = r.activity;

            if (localLOGV) Slog.v(
                TAG, "Resume " + r + " started activity: " +
                a.mStartedActivity + ", hideForNow: " + r.hideForNow
                + ", finished: " + a.mFinished);

            final int forwardBit = isForward ?
                    WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION : 0;

            // If the window hasn't yet been added to the window manager,
            // and this guy didn't finish itself or start another activity,
            // then go ahead and add the window.
            boolean willBeVisible = !a.mStartedActivity;
            if (!willBeVisible) {
                try {
                    willBeVisible = ActivityManagerNative.getDefault().willActivityBeVisible(
                            a.getActivityToken());
                } catch (RemoteException e) {
                }
            }
            if (r.window == null && !a.mFinished && willBeVisible) {
                r.window = r.activity.getWindow();
                View decor = r.window.getDecorView();
                decor.setVisibility(View.INVISIBLE);
                ViewManager wm = a.getWindowManager();
                WindowManager.LayoutParams l = r.window.getAttributes();
                a.mDecor = decor;
                l.type = WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
                l.softInputMode |= forwardBit;
                if (a.mVisibleFromClient) {
                    a.mWindowAdded = true;
                    wm.addView(decor, l);
                }

            // If the window has already been added, but during resume
            // we started another activity, then don't yet make the
            // window visible.
            } else if (!willBeVisible) {
                if (localLOGV) Slog.v(
                    TAG, "Launch " + r + " mStartedActivity set");
                r.hideForNow = true;
            }

            // Get rid of anything left hanging around.
            cleanUpPendingRemoveWindows(r);

            // The window is now visible if it has been added, we are not
            // simply finishing, and we are not starting another activity.
            if (!r.activity.mFinished && willBeVisible
                    && r.activity.mDecor != null && !r.hideForNow) {
                if (r.newConfig != null) {
                    if (DEBUG_CONFIGURATION) Slog.v(TAG, "Resuming activity "
                            + r.activityInfo.name + " with newConfig " + r.newConfig);
                    performConfigurationChanged(r.activity, r.newConfig);
                    freeTextLayoutCachesIfNeeded(r.activity.mCurrentConfig.diff(r.newConfig));
                    r.newConfig = null;
                }
                if (localLOGV) Slog.v(TAG, "Resuming " + r + " with isForward="
                        + isForward);
                WindowManager.LayoutParams l = r.window.getAttributes();
                if ((l.softInputMode
                        & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION)
                        != forwardBit) {
                    l.softInputMode = (l.softInputMode
                            & (~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION))
                            | forwardBit;
                    if (r.activity.mVisibleFromClient) {
                        ViewManager wm = a.getWindowManager();
                        View decor = r.window.getDecorView();
                        wm.updateViewLayout(decor, l);
                    }
                }
                r.activity.mVisibleFromServer = true;
                mNumVisibleActivities++;
                if (r.activity.mVisibleFromClient) {
                    r.activity.makeVisible();
                }
            }

            if (!r.onlyLocalRequest) {
                r.nextIdle = mNewActivities;
                mNewActivities = r;
                if (localLOGV) Slog.v(
                    TAG, "Scheduling idle handler for " + r);
                Looper.myQueue().addIdleHandler(new Idler());
            }
            r.onlyLocalRequest = false;

            // Tell the activity manager we have resumed.
            if (reallyResume) {
                try {
                    ActivityManagerNative.getDefault().activityResumed(token);
                } catch (RemoteException ex) {
                }
            }

        } else {
            // If an exception was thrown when trying to resume, then
            // just end this activity.
            try {
                ActivityManagerNative.getDefault()
                    .finishActivity(token, Activity.RESULT_CANCELED, null, false);
            } catch (RemoteException ex) {
            }
        }
    }

里面有一个 wm.addView(decor, l);把decor赋值给了View的mParent

WindowMangerImpl的addView

@Override
    public void addView(View view, ViewGroup.LayoutParams params) {
        mGlobal.addView(view, params, mDisplay, mParentWindow);
    }
实际上调用了WindowManagerGlobal类的addView

public void addView(View view, ViewGroup.LayoutParams params,Display display, Window parentWindow) {
         ViewRootImpl root;
         synchronized (mLock) {
            root = new ViewRootImpl(view.getContext(), display);

            view.setLayoutParams(wparams);

            mViews.add(view);
            mRoots.add(root);
            mParams.add(wparams);
        try {
            root.setView(view, wparams, panelParentView);
        } catch (RuntimeException e) {
            // BadTokenException or InvalidDisplayException, clean up.
            synchronized (mLock) {
                final int index = findViewLocked(view, false);
                if (index >= 0) {
                    removeViewLocked(index, true);
                }
            }
            throw e;
        }
}
ViewRootImpl的setView

/**
     * We have one child
     */
    public void setView(View view, WindowManager.LayoutParams attrs, View panelParentView) {
        synchronized (this) {
            if (mView == null) {
                mView = view;

                mAttachInfo.mDisplayState = mDisplay.getState();
                mDisplayManager.registerDisplayListener(mDisplayListener, mHandler);

                mViewLayoutDirectionInitial = mView.getRawLayoutDirection();
                mFallbackEventHandler.setView(view);
                mWindowAttributes.copyFrom(attrs);
                if (mWindowAttributes.packageName == null) {
                    mWindowAttributes.packageName = mBasePackageName;
                }
                attrs = mWindowAttributes;
                // Keep track of the actual window flags supplied by the client.
                mClientWindowLayoutFlags = attrs.flags;

                setAccessibilityFocus(null, null);

                if (view instanceof RootViewSurfaceTaker) {
                    mSurfaceHolderCallback =
                            ((RootViewSurfaceTaker)view).willYouTakeTheSurface();
                    if (mSurfaceHolderCallback != null) {
                        mSurfaceHolder = new TakenSurfaceHolder();
                        mSurfaceHolder.setFormat(PixelFormat.UNKNOWN);
                    }
                }

                // Compute surface insets required to draw at specified Z value.
                // TODO: Use real shadow insets for a constant max Z.
                final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
                attrs.surfaceInsets.set(surfaceInset, surfaceInset, surfaceInset, surfaceInset);

                CompatibilityInfo compatibilityInfo = mDisplayAdjustments.getCompatibilityInfo();
                mTranslator = compatibilityInfo.getTranslator();
                mDisplayAdjustments.setActivityToken(attrs.token);

                // If the application owns the surface, don't enable hardware acceleration
                if (mSurfaceHolder == null) {
                    enableHardwareAcceleration(attrs);
                }

                boolean restore = false;
                if (mTranslator != null) {
                    mSurface.setCompatibilityTranslator(mTranslator);
                    restore = true;
                    attrs.backup();
                    mTranslator.translateWindowLayout(attrs);
                }
                if (DEBUG_LAYOUT) Log.d(TAG, "WindowLayout in setView:" + attrs);

                if (!compatibilityInfo.supportsScreen()) {
                    attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                    mLastInCompatMode = true;
                }

                mSoftInputMode = attrs.softInputMode;
                mWindowAttributesChanged = true;
                mWindowAttributesChangesFlag = WindowManager.LayoutParams.EVERYTHING_CHANGED;
                mAttachInfo.mRootView = view;
                mAttachInfo.mScalingRequired = mTranslator != null;
                mAttachInfo.mApplicationScale =
                        mTranslator == null ? 1.0f : mTranslator.applicationScale;
                if (panelParentView != null) {
                    mAttachInfo.mPanelParentWindowToken
                            = panelParentView.getApplicationWindowToken();
                }
                mAdded = true;
                int res; /* = WindowManagerImpl.ADD_OKAY; */

                // Schedule the first layout -before- adding to the window
                // manager, to make sure we do the relayout before receiving
                // any other events from the system.
                requestLayout();
                if ((mWindowAttributes.inputFeatures
                        & WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL) == 0) {
                    mInputChannel = new InputChannel();
                }
                try {
                    mOrigWindowType = mWindowAttributes.type;
                    mAttachInfo.mRecomputeGlobalAttributes = true;
                    collectViewAttributes();
                    res = mWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes,
                            getHostVisibility(), mDisplay.getDisplayId(),
                            mAttachInfo.mContentInsets, mInputChannel);
                } catch (RemoteException e) {
                    mAdded = false;
                    mView = null;
                    mAttachInfo.mRootView = null;
                    mInputChannel = null;
                    mFallbackEventHandler.setView(null);
                    unscheduleTraversals();
                    setAccessibilityFocus(null, null);
                    throw new RuntimeException("Adding window failed", e);
                } finally {
                    if (restore) {
                        attrs.restore();
                    }
                }

                if (mTranslator != null) {
                    mTranslator.translateRectInScreenToAppWindow(mAttachInfo.mContentInsets);
                }
                mPendingOverscanInsets.set(0, 0, 0, 0);
                mPendingContentInsets.set(mAttachInfo.mContentInsets);
                mPendingStableInsets.set(mAttachInfo.mStableInsets);
                mPendingVisibleInsets.set(0, 0, 0, 0);
                if (DEBUG_LAYOUT) Log.v(TAG, "Added window " + mWindow);
                if (res < WindowManagerGlobal.ADD_OKAY) {
                    mAttachInfo.mRootView = null;
                    mAdded = false;
                    mFallbackEventHandler.setView(null);
                    unscheduleTraversals();
                    setAccessibilityFocus(null, null);
                    switch (res) {
                        case WindowManagerGlobal.ADD_BAD_APP_TOKEN:
                        case WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN:
                            throw new WindowManager.BadTokenException(
                                "Unable to add window -- token " + attrs.token
                                + " is not valid; is your activity running?");
                        case WindowManagerGlobal.ADD_NOT_APP_TOKEN:
                            throw new WindowManager.BadTokenException(
                                "Unable to add window -- token " + attrs.token
                                + " is not for an application");
                        case WindowManagerGlobal.ADD_APP_EXITING:
                            throw new WindowManager.BadTokenException(
                                "Unable to add window -- app for token " + attrs.token
                                + " is exiting");
                        case WindowManagerGlobal.ADD_DUPLICATE_ADD:
                            throw new WindowManager.BadTokenException(
                                "Unable to add window -- window " + mWindow
                                + " has already been added");
                        case WindowManagerGlobal.ADD_STARTING_NOT_NEEDED:
                            // Silently ignore -- we would have just removed it
                            // right away, anyway.
                            return;
                        case WindowManagerGlobal.ADD_MULTIPLE_SINGLETON:
                            throw new WindowManager.BadTokenException(
                                "Unable to add window " + mWindow +
                                " -- another window of this type already exists");
                        case WindowManagerGlobal.ADD_PERMISSION_DENIED:
                            throw new WindowManager.BadTokenException(
                                "Unable to add window " + mWindow +
                                " -- permission denied for this window type");
                        case WindowManagerGlobal.ADD_INVALID_DISPLAY:
                            throw new WindowManager.InvalidDisplayException(
                                "Unable to add window " + mWindow +
                                " -- the specified display can not be found");
                    }
                    throw new RuntimeException(
                        "Unable to add window -- unknown error code " + res);
                }

                if (view instanceof RootViewSurfaceTaker) {
                    mInputQueueCallback =
                        ((RootViewSurfaceTaker)view).willYouTakeTheInputQueue();
                }
                if (mInputChannel != null) {
                    if (mInputQueueCallback != null) {
                        mInputQueue = new InputQueue();
                        mInputQueueCallback.onInputQueueCreated(mInputQueue);
                    }
                    mInputEventReceiver = new WindowInputEventReceiver(mInputChannel,
                            Looper.myLooper());
                }

                view.assignParent(this);
                mAddedTouchMode = (res & WindowManagerGlobal.ADD_FLAG_IN_TOUCH_MODE) != 0;
                mAppVisible = (res & WindowManagerGlobal.ADD_FLAG_APP_VISIBLE) != 0;

                if (mAccessibilityManager.isEnabled()) {
                    mAccessibilityInteractionConnectionManager.ensureConnection();
                }

                if (view.getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
                    view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
                }

                // Set up the input pipeline.
                CharSequence counterSuffix = attrs.getTitle();
                mSyntheticInputStage = new SyntheticInputStage();
                InputStage viewPostImeStage = new ViewPostImeInputStage(mSyntheticInputStage);
                InputStage nativePostImeStage = new NativePostImeInputStage(viewPostImeStage,
                        "aq:native-post-ime:" + counterSuffix);
                InputStage earlyPostImeStage = new EarlyPostImeInputStage(nativePostImeStage);
                InputStage imeStage = new ImeInputStage(earlyPostImeStage,
                        "aq:ime:" + counterSuffix);
                InputStage viewPreImeStage = new ViewPreImeInputStage(imeStage);
                InputStage nativePreImeStage = new NativePreImeInputStage(viewPreImeStage,
                        "aq:native-pre-ime:" + counterSuffix);

                mFirstInputStage = nativePreImeStage;
                mFirstPostImeInputStage = earlyPostImeStage;
                mPendingInputEventQueueLengthCounterName = "aq:pending:" + counterSuffix;
            }
        }
    }

调用了View里面的assignParent把自己赋值给了mParent,即ViewRootImpl










本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

View的mParent变量初始化 的相关文章

  • 「GNOME 3」- 修改 Topbar 字体(顶部栏字体)、调整默认主题 @20210211

    问题描述 在 GNOME 3 中 xff0c 在进行字体设置时 xff0c 我们发现 Topbar 的字体没有修改 xff0c 因此窗口字体与 Topbar 字体不同 经过搜索 xff0c 我们知道 xff0c Topbar 的字体是主题负
  • 「KVM」- 常见错误及注意事项 @20210223

    启动错误 1 vmport is not available with this QEMU binary 问题描述 xff1a 启动Guest时产生如下错误 xff1a error unsupported configuration vmp
  • 「Jumpserver」- 通过 SSH 连接 Jumpserver 资产 @20210302

    问题描述 在通常情况下 xff0c 我们会通过 Web 界面访问资产 执行命令 xff0c 以进行服务器管理 但是 xff0c 有时候我们也需要通过 SSH 客户端连接服务器 Jumpserver 提供对此的支持 该笔记将记录 xff1a
  • 「Selenium」- 在页面中,点击按钮(或元素) @20210311

    问题描述 该笔记将记录 xff1a 在 Selenium 中 xff0c 如何使用代码点击按钮 xff0c 以及常见问题处理 解决方案 使用 click 点击 通常点击元素使用 click 方法即可 xff1a 选择元素并进行点击 webD
  • 「Linux」- 安装网易云音乐(Neteast Cloud Music) @20210330

    问题描述 我们想在 Ubuntu 20 04 LTS 中安装网易云音乐 xff08 Neteast Cloud Music xff09 xff0c 自然是用来播放音乐 该笔记将记录 xff1a 在 Debian 及衍生版 xff08 比如
  • LaTex | 导出 PNG 图片

    问题描述 我们需要将 LaTeX 文档转换为 PNG 图片 xff08 我们需要使用 LaTeX 的 bytefield 包绘制 字节序列图 xff0c 以在 Zim 中显示 xff09 该笔记将记录 xff1a 如何使用 tex 文件 x
  • Linux:邮箱客户端

    原文地址 xff1a Linux xff1a 邮箱客户端 xff08 永久地址 xff0c 保存网址不迷路 x1f643 xff09 问题描述 我们最开始使用 Thunderbird 邮件客户端 xff0c 但是在 GNOME 3 中当收到
  • Synergy : 多电脑共享鼠标和键盘

    原文地址 xff1a Synergy 多电脑共享鼠标和键盘 xff08 永久地址 xff0c 保存网址不迷路 x1f643 xff09 注意事项 目前 xff08 09 28 2020 xff09 xff0c 建议使用 Barrier xf
  • eslint常用

    0 xff0c 1 xff0c 2分别表示off warning error三个错误级别
  • Kubernetes Objects│Service

    原文地址 xff1a Kubernetes Objects Service xff08 永久地址 xff0c 保存网址不迷路 x1f643 xff09 Service xff0c 服务 xff0c 用于暴露 Pod 以供访问 官方文档及手册
  • draw.io - 安装

    原文地址 xff1a draw io 安装 xff08 永久地址 xff0c 保存网址不迷路 x1f643 xff09 问题描述 我们没有采用自建 draw io 服务 xff0c 而是使用它的客户端 jgraph drawio deskt
  • Android网络优先级及更改

    Android版本 xff1a Android 4 4 4 涉及内容 xff1a 1 xff0c 网络优先级 xff1b 2 xff0c 网络切换 xff1b 3 xff0c 界面显示 解决问题 xff1a 1 xff0c 更改网络优先级
  • Java生产者、消费者模式的几种实现方式

    文章目录 方式一 xff1a BlockingQueue方式 最优方式 方式二 xff1a Synchronized 43 wait notifyAll方式方式三 xff1a ReentrantLock 43 Condition方式几种方式
  • 常识 让世界充满AI

    5 https sci hub cc 下载论文 4 问题 等于 机遇 问题抽象为可以解决执行的问题 xff0c 例如 xff1a 自动驾驶 xff0c 细化为特定场景下的自驾车 xff0c 如观光车 xff0c 公交车等 公司的核心是数据
  • iOS-NSLineBreakMode-lineBreakMode属性详解(UILabel省略号位置)

    apple文档 64 property nonatomic NSLineBreakMode lineBreakMode default is NSLineBreakByTruncatingTail used for single and m
  • spark机器学习笔记:(一)Spark Python初探

    声明 xff1a 版权所有 xff0c 转载请联系作者并注明出处 http blog csdn net u013719780 viewmode 61 contents 博主简介 xff1a 风雪夜归子 xff08 英文名 xff1a All
  • Jackson 解析 JSON 详细教程

    点赞再看 xff0c 动力无限 微信搜 程序猿阿朗 本文 Github com niumoo JavaNotes 和 未读代码博客 已经收录 xff0c 有很多知识点和系列文章 JSON 对于开发者并不陌生 xff0c 如今的 WEB 服务
  • 百度百科全站爬取教程

    百度百科全站 目前有16 330 473个词条 这里介绍一个基于scrapy的分布式百度百科爬虫 xff0c 能够全量爬取百度百科的词条 github地址 特性 百科类网站全站词条抓取 xff0c 包括百度百科 互动百科 wiki中英文站点
  • 贪心法

    贪心法 lt gt 贪心算法并不是从整体最优上加以考虑 xff0c 而是从局部最优考虑 xff0c 每次总是做出当前看起来最好的选择 xff0c 在某种意义上的局部最优选择 xff1b lt gt 最优子结构性质 xff1a lt gt 贪
  • shasum: command not found

    yum install perl Digest SHA

随机推荐

  • 记一次http请求报400问题

    引言 由于之前代码比较老 xff0c 都是采用http1 0方式请求 xff0c 于是采用了之前的代码进行实现 xff0c 结果之前测试没有问题 xff0c 后面投产了就报400错误了 xff0c 重新测试还是没有问题 最后通过接收方日志排
  • 数组下标排序

    前言 平时大家大多都是对数组进行各种方式的排序 xff0c 很少对数组的下标进行排序 xff0c 什么是对数组的下标进行排序 xff1f 即按数组值的大小对相应的数组下标进行排序 具体方法见以下正文 正文 解题的重点是如何保存值和下标的对应
  • SpringBoot项目无法接收到数据(Whitelabel Error Page)

    前言 在一次SpringBoot项目模块迁移的过程中 xff0c 新建的模块无法接收到前端的数据 xff0c 在地址栏输入对应的url后显示Whitelabel Error Page 正文 核对了url以及启动类上注解 64 SpringB
  • 解决android7.1系统出现的Consumer closed input channel or an error occurred. events=0x9错误

    自己实现的一个Socket聊天app xff0c 这个app是在17年的时候写的 xff08 当时也是随便写的 xff0c 没注意太多细节 xff09 xff0c 那个时候还是android4 4系统的手机 xff0c 然后写完在真机上调试
  • Java实现多线程轮流打印1-100的数字

    正文 首先打印1 100数字如果用一个单线程实现那么只要一个for循环即可 xff0c 那么如果要用两个线程打印出来呢 xff1f xff08 一个线程打印奇数 xff0c 一个线程打印偶数 xff09 于是大家会想到可以通过加锁实现 xf
  • 安卓手机利用DroidCam当电脑摄像头使用方法

    笔记本电脑有点老了 xff0c 摄像头好像坏了 xff0c 重装了一下午驱动都没弄好 xff0c 换了ubuntu系统也打不开摄像头 xff0c 然后就放弃了 xff0c 于是想到了能不能用android手机当笔记本电脑的摄像头 xff1f
  • Dell安装驱动程序出现的错误(DupAPI::Execute): *** Shell Execute Error. System error text

    在官网下的驱动却怎么也安装不上 xff0c 一直提示 The update installer operation is unsuccessful 然后打开日志文件查看 xfeff 04 10 19 10 12 11 Update Pack
  • 浮点数大小比较

    引言 在一次某公司的笔试题中出现了一题在一个无序的浮点数数组中找出相同的数 xff0c 那么在计算机中一般的整型的十进制数一般都是直接通过 61 61 来判断两个数是否相等的 xff0c 但是如果是浮点数还可以用这样的方式进行判断吗 xff
  • int的取值范围

    引言 在学C 43 43 或者Java的时候应该都会先了解各种基本数据类型的初值和它们的取值范围 xff0c 有些人可能会不太重视这块内容 xff0c 其实很重要 xff0c 很多大公司面试的过程中都会问到int的取值范围 xff0c 溢出
  • Intel汇编语言程序设计学习-第三章 汇编语言基础-上

    汇编语言基础 3 1 汇编语言的基本元素 有人说汇编难 xff0c 有人说汇编简单 xff0c 我个人不做评价 xff0c 下面是一个简单的实例 xff08 部分代码 xff09 xff1a main PROC mov eax 5 5送 E
  • 向量和矩阵范数

    参考 xff1a https en wikipedia org wiki Matrix norm Frobenius norm https blog csdn net Michael Corleone article details 752
  • ubuntu安装后分辨率只有一个选项

    ubuntu 16 04安装后分辨率只有一个选项 1024x768 xff0c 使用xrandr命令出现错误 xff1a xrandr Failed to get size of gamma for output default xff0c
  • android.hardware.Camera入坑之旅

    1 相机预览方向适配 可以参考谷歌官方适配方案 public static void setCameraDisplayOrientation Activity activity int cameraId android hardware C
  • MySQL深入的学习笔记

    MYSQL高级 MySql架构演变 这个很重要 软件的环境是如何从单应用算法极致优化的方向 到分布式的进化 这个时代 就会淘汰好多单体应用的coder 比如我自己 哈哈哈哈 1 0时代 单机单库 单应用 单数据库 快速 方便 好维护 并发量
  • Java变量的声明、初始化和作用域

    一 Java变量的声明 在 Java 程序设计中 xff0c 每个声明的变量都必须分配一个类型 声明一个变量时 xff0c 应该先声明变量的类型 xff0c 随后再声明变量的名字 下面演示了变量的声明方式 double salary int
  • 无线网卡无法启动(代码 10),怎么办?

    前言 无线网卡突然无法启动 xff0c 代码 10 xff0c 怎么办 xff1f 本文记述了作者遇到这个问题的经历和最终解决方法 xff0c 希望我的分享能给大家节约宝贵时间 一 我遇到的问题 先说明一下 xff1a 我用的是华硕的飞行堡
  • systemd内置变量

    替换符含义 b系统的 34 Boot ID 34 字符串 参见 random 4 手册 C缓存根目录 对于系统实例来说是 var cache xff1b 对于用户实例来说是 XDG CACHE HOME E配置根目录 对于系统实例来说是 e
  • IOS轻松实现仿网易新闻顶部滑动指示器(Scrollview实现)

    实现原理很简单 xff0c 就是利用了scrollview进行自定义 xff0c 对外部传入的scrollview滑动事件进行监听 xff0c 源码如下 xff1a xff08 1 xff09 h文件代码 ScrollViewIndicat
  • 【极客日常】Go语言string、int、float、rune、byte等数据类型的转换方法

    golang的数据类型转换是困惑新gopher的一大问题之一 相对于python xff0c golang的数据类型转换可要麻烦的多 xff0c 而且还不走寻常路地诞生了些新的方法跟名词 因此本文讲解golang常见数据类型string i
  • View的mParent变量初始化

    mParent变量实际上是PhoneWindow DecorView类型 xff0c 是所有应用窗口的根视图 xff0c 是FrameLayout的子类 View的requestLayout 函数也是调用了mParent requestLa