‘when’语句跳过Android的Kotlin条件

我一直在使用kotlin在android studio canary 5上开发应用程序。 我正在使用when语句来validationregistry单是否有效。

else if(registering) when { email.text == null -> email.error = "Enter Email!" !isValidEmail(email.text) -> email.error = "Invalid Email!" password.text == null -> password.error = "Enter Password!" password_conf.text == null -> password_conf.error = "Re-enter Password!" password_conf.text.toString() != password.text.toString() -> password_conf.error = "Re-enter Password!" password_conf.text.toString() != password.text.toString() -> password_conf.error = "Passwords Don't Match!" name.text == null -> name.error = "Enter Full Name!" branchSelected == "Branch" ->{ val errorText = branch.selectedView as TextView errorText.error = "" errorText.setTextColor(Color.RED) errorText.text = getString(R.string.select_branch) } phone.text == null || !isValidPhone(phone.text) -> phone.error = "Enter Valid Phone Number!" !isValidReg(reg_number.text) -> reg_number.error = "Invalid Registration Number" roll_number.text != null && !isValidRoll(roll_number.text) -> roll_number.error = "Enter Valid roll number!" else -> { createAccount(email.text.toString(), password.text.toString()) addDB() } } 

password.text == null -> password.error = "Enter Password!"password.text == null -> password.error = "Enter Password!" 由于某种原因不起作用。

我很喜欢90%,因为email.text == null -> email.error = "Enter Email!" 工作得很好,android studio颜色代码variables。

可以发生错误,因为android studio kotlin支持处于测试版或其他原因?

更新:如JK Ly建议,这里是电子邮件和密码的价值:

 (When I kept email empty) email = {AppCompatEditText@5191} "android.support.v7.widget.AppCompatEditText{c15a402 VFED..CL. .F...... 79,242-1001,360 #7f09003d app:id/email}" mBackgroundTintHelper = {AppCompatBackgroundHelper@5243} mTextHelper = {AppCompatTextHelperV17@5244} mAllowTransformationLengthChange = false mAutoLinkMask = 0 mBoring = null mBreakStrategy = 0 mBufferType = {TextView$BufferType@5245} "EDITABLE" mChangeWatcher = {TextView$ChangeWatcher@5246} mCharWrapper = null mCurHintTextColor = 1627389952 mCurTextColor = -570425344 mCurrentSpellCheckerLocaleCache = null mCursorDrawableRes = 17303397 mDeferScroll = -1 mDesiredHeightAtMeasure = 118 mDeviceProvisionedState = 0 mDrawables = null mEditableFactory = {Editable$Factory@5247} mEditor = {Editor@5248} mEllipsize = null mFilters = {InputFilter[0]@5249} mFreezesText = false mGravity = 8388627 mHighlightColor = 1711314568 mHighlightPaint = {Paint@5250} mHighlightPath = {Path@5251} mHighlightPathBogus = false mHint = "Email" mHintBoring = {BoringLayout$Metrics@5253} "FontMetricsInt: top=-50 ascent=-44 descent=11 bottom=13 leading=0 width=116" mHintLayout = {BoringLayout@5254} mHintTextColor = {ColorStateList@5255} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[16842910, 16842919], []]mColors=[-1979711488, 1627389952]mDefaultColor=1627389952}" mHorizontallyScrolling = true mHyphenationFrequency = 1 mIncludePad = true mLastLayoutDirection = 0 mLastScroll = 0 mLayout = {DynamicLayout@5256} mLinkTextColor = {ColorStateList@5257} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[]]mColors=[-16738680]mDefaultColor=-16738680}" mLinksClickable = true mListeners = null mLocalesChanged = false mMarquee = null mMarqueeFadeMode = 0 mMarqueeRepeatLimit = 3 mMaxMode = 1 mMaxWidth = 2147483647 mMaxWidthMode = 2 mMaximum = 1 mMinMode = 1 mMinWidth = 0 mMinWidthMode = 2 mMinimum = 1 mMovement = {ArrowKeyMovementMethod@5258} mOldMaxMode = 1 mOldMaximum = 1 mPreDrawListenerDetached = false mPreDrawRegistered = false mPreventDefaultMovement = false mRestartMarquee = false mSavedHintLayout = {BoringLayout@5254} mSavedLayout = null mSavedMarqueeModeLayout = null mScroller = null mShadowColor = 0 mShadowDx = 0.0 mShadowDy = 0.0 mShadowRadius = 0.0 mSingleLine = true mSpacingAdd = 0.0 mSpacingMult = 1.0 mSpannableFactory = {Spannable$Factory@5259} mTempRect = {Rect@5260} "Rect(87, 305 - 91, 423)" mText = {SpannableStringBuilder@5261} "" mFilters = {InputFilter[1]@5289} mGapLength = 10 mGapStart = 0 mIndexOfSpan = {IdentityHashMap@5290} size = 7 mLowWaterMark = 2147483647 mOrderSortBuffer = {int[9]@5291} mPrioSortBuffer = {int[9]@5292} mSpanCount = 7 mSpanEnds = {int[9]@5293} mSpanFlags = {int[9]@5294} mSpanInsertCount = 19 mSpanMax = {int[7]@5295} mSpanOrder = {int[9]@5296} mSpanStarts = {int[9]@5297} mSpans = {Object[9]@5298} mText = {char[10]@5299} mTextWatcherDepth = 0 shadow$_klass_ = {Class@529} "class android.text.SpannableStringBuilder" shadow$_monitor_ = -2077412599 mTextColor = {ColorStateList@5262} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[-16842910], []]mColors=[973078528, -570425344]mDefaultColor=-570425344}" mTextDir = {TextDirectionHeuristics$TextDirectionHeuristicInternal@5263} mTextEditSuggestionContainerLayout = 17367285 mTextEditSuggestionHighlightStyle = 16974923 mTextEditSuggestionItemLayout = 17367287 mTextPaint = {TextPaint@5264} mTextSelectHandleLeftRes = 17303401 mTextSelectHandleRes = 17303403 mTextSelectHandleRightRes = 17303405 mTransformation = {SingleLineTransformationMethod@5265} mTransformed = {ReplacementTransformationMethod$SpannedReplacementCharSequence@5266} "" mUserSetTextScaleX = false mAccessibilityCursorPosition = -1 mAccessibilityDelegate = null mAccessibilityTraversalAfterId = -1 mAccessibilityTraversalBeforeId = -1 mAccessibilityViewId = -1 mAnimator = null mAttachInfo = {View$AttachInfo@5267} mAttributes = null mBackground = {InsetDrawable@5268} mBackgroundRenderNode = {RenderNode@5269} mBackgroundResource = 0 mBackgroundSizeChanged = false mBackgroundTint = null mBottom = 360 mCachingFailed = false mClipBounds = null mContentDescription = null mContext = {LoginActivity@5188} mCurrentAnimation = null mDrawableState = {int[4]@5270} mDrawingCache = null mDrawingCacheBackgroundColor = 0 mFloatingTreeObserver = null mForegroundInfo = null mFrameMetricsObservers = null mGhostView = null mHasPerformedLongPress = false mID = 2131296317 mIgnoreNextUpEvent = false mInContextButtonPress = false mInputEventConsistencyVerifier = null mKeyedTags = null mLabelForId = -1 mLastIsOpaque = false mLayerPaint = null mLayerType = 0 mLayoutInsets = null mLayoutParams = {LinearLayout$LayoutParams@5271} mLeft = 79 mLeftPaddingDefined = false mListenerInfo = null mLongClickX = NaN mLongClickY = NaN mMatchIdPredicate = null mMatchLabelForPredicate = null mMeasureCache = {LongSparseLongArray@5272} "{4611689978387236305=3959959847030}" mMeasuredHeight = 118 mMeasuredWidth = 922 mMinHeight = 0 View.mMinWidth = 0 mNestedScrollingParent = null mNextFocusDownId = -1 mNextFocusForwardId = -1 mNextFocusLeftId = -1 mNextFocusRightId = -1 mNextFocusUpId = -1 mOldHeightMeasureSpec = 1489 mOldWidthMeasureSpec = 1073742746 mOutlineProvider = {ViewOutlineProvider$1@5273} mOverScrollMode = 1 mOverlay = null mPaddingBottom = 29 mPaddingLeft = 10 mPaddingRight = 10 mPaddingTop = 26 mParent = {LinearLayout@5274} "android.widget.LinearLayout{2b0397d VE..... ........ 0,0-1080,1997 #7f090000 app:id/SignIn_Layout}" mPendingCheckForLongPress = null mPendingCheckForTap = null mPerformClick = null mPointerIcon = null mPrivateFlags = 16812082 mPrivateFlags2 = 1611867688 mPrivateFlags3 = 4 mRecreateDisplayList = false mRenderNode = {RenderNode@5275} mResources = {Resources@5227} mRight = 1001 mRightPaddingDefined = false mRunQueue = {HandlerActionQueue@5276} mScrollCache = null mScrollIndicatorDrawable = null mScrollX = 0 mScrollY = 0 mSendViewScrolledAccessibilityEvent = null mSendViewStateChangedAccessibilityEvent = null mSendingHoverAccessibilityEvents = false mStartActivityRequestWho = null mStateListAnimator = null mSystemUiVisibility = 0 mTag = null mTempNestedScrollConsumed = null mTop = 242 mTouchDelegate = null mTouchSlop = 21 mTransformationInfo = {View$TransformationInfo@5277} mTransientStateCount = 0 mTransitionName = null mUnscaledDrawingCache = null mUnsetPressedState = null mUserPaddingBottom = 29 mUserPaddingEnd = -2147483648 mUserPaddingLeft = 10 mUserPaddingLeftInitial = 10 mUserPaddingRight = 10 mUserPaddingRightInitial = 10 mUserPaddingStart = -2147483648 mVerticalScrollFactor = 0.0 mVerticalScrollbarPosition = 0 mViewFlags = 405028865 mWindowAttachCount = 1 shadow$_klass_ = {Class@5076} "class android.support.v7.widget.AppCompatEditText" shadow$_monitor_ = -1944738814 (When I gave some value of email) email = {AppCompatEditText@5199} "android.support.v7.widget.AppCompatEditText{9041f8b VFED..CL. .F...... 79,242-1001,360 #7f09003d app:id/email}" mBackgroundTintHelper = {AppCompatBackgroundHelper@5250} mTextHelper = {AppCompatTextHelperV17@5251} mAllowTransformationLengthChange = false mAutoLinkMask = 0 mBoring = null mBreakStrategy = 0 mBufferType = {TextView$BufferType@5252} "EDITABLE" mChangeWatcher = {TextView$ChangeWatcher@5253} mCharWrapper = null mCurHintTextColor = 1627389952 mCurTextColor = -570425344 mCurrentSpellCheckerLocaleCache = null mCursorDrawableRes = 17303397 mDeferScroll = -1 mDesiredHeightAtMeasure = 118 mDeviceProvisionedState = 0 mDrawables = null mEditableFactory = {Editable$Factory@5254} mEditor = {Editor@5255} mEllipsize = null mFilters = {InputFilter[0]@5256} mFreezesText = false mGravity = 8388627 mHighlightColor = 1711314568 mHighlightPaint = {Paint@5257} mHighlightPath = {Path@5258} mHighlightPathBogus = false mHint = "Email" mHintBoring = {BoringLayout$Metrics@5260} "FontMetricsInt: top=-50 ascent=-44 descent=11 bottom=13 leading=0 width=116" mHintLayout = {BoringLayout@5261} mHintTextColor = {ColorStateList@5262} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[16842910, 16842919], []]mColors=[-1979711488, 1627389952]mDefaultColor=1627389952}" mHorizontallyScrolling = true mHyphenationFrequency = 1 mIncludePad = true mLastLayoutDirection = 0 mLastScroll = 0 mLayout = {DynamicLayout@5263} mLinkTextColor = {ColorStateList@5264} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[]]mColors=[-16738680]mDefaultColor=-16738680}" mLinksClickable = true mListeners = null mLocalesChanged = false mMarquee = null mMarqueeFadeMode = 0 mMarqueeRepeatLimit = 3 mMaxMode = 1 mMaxWidth = 2147483647 mMaxWidthMode = 2 mMaximum = 1 mMinMode = 1 mMinWidth = 0 mMinWidthMode = 2 mMinimum = 1 mMovement = {ArrowKeyMovementMethod@5265} mOldMaxMode = 1 mOldMaximum = 1 mPreDrawListenerDetached = false mPreDrawRegistered = false mPreventDefaultMovement = false mRestartMarquee = false mSavedHintLayout = {BoringLayout@5261} mSavedLayout = null mSavedMarqueeModeLayout = null mScroller = null mShadowColor = 0 mShadowDx = 0.0 mShadowDy = 0.0 mShadowRadius = 0.0 mSingleLine = true mSpacingAdd = 0.0 mSpacingMult = 1.0 mSpannableFactory = {Spannable$Factory@5266} mTempRect = {Rect@5267} "Rect(374, 305 - 378, 423)" mText = {SpannableStringBuilder@5268} "wfm@dm.ssc" mTextColor = {ColorStateList@5269} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[-16842910], []]mColors=[973078528, -570425344]mDefaultColor=-570425344}" mTextDir = {TextDirectionHeuristics$TextDirectionHeuristicInternal@5270} mTextEditSuggestionContainerLayout = 17367285 mTextEditSuggestionHighlightStyle = 16974923 mTextEditSuggestionItemLayout = 17367287 mTextPaint = {TextPaint@5271} mTextSelectHandleLeftRes = 17303401 mTextSelectHandleRes = 17303403 mTextSelectHandleRightRes = 17303405 mTransformation = {SingleLineTransformationMethod@5272} mTransformed = {ReplacementTransformationMethod$SpannedReplacementCharSequence@5273} "wfm@dm.ssc" mUserSetTextScaleX = false mAccessibilityCursorPosition = -1 mAccessibilityDelegate = null mAccessibilityTraversalAfterId = -1 mAccessibilityTraversalBeforeId = -1 mAccessibilityViewId = -1 mAnimator = null mAttachInfo = {View$AttachInfo@5274} mAttributes = null mBackground = {InsetDrawable@5275} mBackgroundRenderNode = {RenderNode@5276} mBackgroundResource = 0 mBackgroundSizeChanged = false mBackgroundTint = null mBottom = 360 mCachingFailed = false mClipBounds = null mContentDescription = null mContext = {LoginActivity@5195} mCurrentAnimation = null mDrawableState = {int[4]@5277} mDrawingCache = null mDrawingCacheBackgroundColor = 0 mFloatingTreeObserver = null mForegroundInfo = null mFrameMetricsObservers = null mGhostView = null mHasPerformedLongPress = false mID = 2131296317 mIgnoreNextUpEvent = false mInContextButtonPress = false mInputEventConsistencyVerifier = null mKeyedTags = null mLabelForId = -1 mLastIsOpaque = false mLayerPaint = null mLayerType = 0 mLayoutInsets = null mLayoutParams = {LinearLayout$LayoutParams@5278} mLeft = 79 mLeftPaddingDefined = false mListenerInfo = null mLongClickX = NaN mLongClickY = NaN mMatchIdPredicate = null mMatchLabelForPredicate = null mMeasureCache = {LongSparseLongArray@5279} "{4611689978387236305=3959959847030}" mMeasuredHeight = 118 mMeasuredWidth = 922 mMinHeight = 0 View.mMinWidth = 0 mNestedScrollingParent = null mNextFocusDownId = -1 mNextFocusForwardId = -1 mNextFocusLeftId = -1 mNextFocusRightId = -1 mNextFocusUpId = -1 mOldHeightMeasureSpec = 1489 mOldWidthMeasureSpec = 1073742746 mOutlineProvider = {ViewOutlineProvider$1@5280} mOverScrollMode = 1 mOverlay = null mPaddingBottom = 29 mPaddingLeft = 10 mPaddingRight = 10 mPaddingTop = 26 mParent = {LinearLayout@5281} "android.widget.LinearLayout{bd21b35 VE..... ........ 0,0-1080,1997 #7f090000 app:id/SignIn_Layout}" mPendingCheckForLongPress = null mPendingCheckForTap = null mPerformClick = null mPointerIcon = null mPrivateFlags = 16812082 mPrivateFlags2 = 1611867688 mPrivateFlags3 = 4 mRecreateDisplayList = false mRenderNode = {RenderNode@5282} mResources = {Resources@5234} mRight = 1001 mRightPaddingDefined = false mRunQueue = {HandlerActionQueue@5283} mScrollCache = null mScrollIndicatorDrawable = null mScrollX = 0 mScrollY = 0 mSendViewScrolledAccessibilityEvent = null mSendViewStateChangedAccessibilityEvent = null mSendingHoverAccessibilityEvents = false mStartActivityRequestWho = null mStateListAnimator = null mSystemUiVisibility = 0 mTag = null mTempNestedScrollConsumed = null mTop = 242 mTouchDelegate = null mTouchSlop = 21 mTransformationInfo = {View$TransformationInfo@5284} mTransientStateCount = 0 mTransitionName = null mUnscaledDrawingCache = null mUnsetPressedState = null mUserPaddingBottom = 29 mUserPaddingEnd = -2147483648 mUserPaddingLeft = 10 mUserPaddingLeftInitial = 10 mUserPaddingRight = 10 mUserPaddingRightInitial = 10 mUserPaddingStart = -2147483648 mVerticalScrollFactor = 0.0 mVerticalScrollbarPosition = 0 mViewFlags = 405028865 mWindowAttachCount = 1 shadow$_klass_ = {Class@5076} "class android.support.v7.widget.AppCompatEditText" shadow$_monitor_ = -1996218485 password = {AppCompatEditText@5200} "android.support.v7.widget.AppCompatEditText{8dff868 VFED..CL. ........ 79,400-1001,518 #7f090075 app:id/password}" mBackgroundTintHelper = {AppCompatBackgroundHelper@5308} mTextHelper = {AppCompatTextHelperV17@5309} mAllowTransformationLengthChange = false mAutoLinkMask = 0 mBoring = null mBreakStrategy = 0 mBufferType = {TextView$BufferType@5252} "EDITABLE" mChangeWatcher = {TextView$ChangeWatcher@5310} mCharWrapper = null mCurHintTextColor = 1627389952 mCurTextColor = -570425344 mCurrentSpellCheckerLocaleCache = null mCursorDrawableRes = 17303397 mDeferScroll = -1 mDesiredHeightAtMeasure = 118 mDeviceProvisionedState = 0 mDrawables = null mEditableFactory = {Editable$Factory@5254} mEditor = {Editor@5311} mEllipsize = null mFilters = {InputFilter[0]@5256} mFreezesText = false mGravity = 8388627 mHighlightColor = 1711314568 mHighlightPaint = {Paint@5312} mHighlightPath = null mHighlightPathBogus = true mHint = "Password" mHintBoring = {BoringLayout$Metrics@5314} "FontMetricsInt: top=-50 ascent=-44 descent=11 bottom=13 leading=0 width=224" mHintLayout = {BoringLayout@5315} mHintTextColor = {ColorStateList@5262} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[16842910, 16842919], []]mColors=[-1979711488, 1627389952]mDefaultColor=1627389952}" mHorizontallyScrolling = true mHyphenationFrequency = 1 mIncludePad = true mLastLayoutDirection = 0 mLastScroll = 0 mLayout = {DynamicLayout@5316} mLinkTextColor = {ColorStateList@5264} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[]]mColors=[-16738680]mDefaultColor=-16738680}" mLinksClickable = true mListeners = null mLocalesChanged = false mMarquee = null mMarqueeFadeMode = 0 mMarqueeRepeatLimit = 3 mMaxMode = 1 mMaxWidth = 2147483647 mMaxWidthMode = 2 mMaximum = 1 mMinMode = 1 mMinWidth = 0 mMinWidthMode = 2 mMinimum = 1 mMovement = {ArrowKeyMovementMethod@5265} mOldMaxMode = 1 mOldMaximum = 1 mPreDrawListenerDetached = false mPreDrawRegistered = false mPreventDefaultMovement = false mRestartMarquee = false mSavedHintLayout = {BoringLayout@5315} mSavedLayout = null mSavedMarqueeModeLayout = null mScroller = null mShadowColor = 0 mShadowDx = 0.0 mShadowDy = 0.0 mShadowRadius = 0.0 mSingleLine = true mSpacingAdd = 0.0 mSpacingMult = 1.0 mSpannableFactory = {Spannable$Factory@5266} mTempRect = null mText = {SpannableStringBuilder@5317} "" mTextColor = {ColorStateList@5269} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[-16842910], []]mColors=[973078528, -570425344]mDefaultColor=-570425344}" mTextDir = {TextDirectionHeuristics$TextDirectionHeuristicInternal@5318} mTextEditSuggestionContainerLayout = 17367285 mTextEditSuggestionHighlightStyle = 16974923 mTextEditSuggestionItemLayout = 17367287 mTextPaint = {TextPaint@5319} mTextSelectHandleLeftRes = 17303401 mTextSelectHandleRes = 17303403 mTextSelectHandleRightRes = 17303405 mTransformation = {PasswordTransformationMethod@5320} mTransformed = {PasswordTransformationMethod$PasswordCharSequence@5321} "" mUserSetTextScaleX = false mAccessibilityCursorPosition = -1 mAccessibilityDelegate = null mAccessibilityTraversalAfterId = -1 mAccessibilityTraversalBeforeId = -1 mAccessibilityViewId = -1 mAnimator = null mAttachInfo = {View$AttachInfo@5274} mAttributes = null mBackground = {InsetDrawable@5322} mBackgroundRenderNode = {RenderNode@5323} mBackgroundResource = 0 mBackgroundSizeChanged = false mBackgroundTint = null mBottom = 518 mCachingFailed = false mClipBounds = null mContentDescription = null mContext = {LoginActivity@5195} mCurrentAnimation = null mDrawableState = {int[3]@5324} mDrawingCache = null mDrawingCacheBackgroundColor = 0 mFloatingTreeObserver = null mForegroundInfo = null mFrameMetricsObservers = null mGhostView = null mHasPerformedLongPress = false mID = 2131296373 mIgnoreNextUpEvent = false mInContextButtonPress = false mInputEventConsistencyVerifier = null mKeyedTags = null mLabelForId = -1 mLastIsOpaque = false mLayerPaint = null mLayerType = 0 mLayoutInsets = null mLayoutParams = {LinearLayout$LayoutParams@5278} mLeft = 79 mLeftPaddingDefined = false mListenerInfo = null mLongClickX = NaN mLongClickY = NaN mMatchIdPredicate = null mMatchLabelForPredicate = null mMeasureCache = {LongSparseLongArray@5325} "{4611689978387236147=3959959847030}" mMeasuredHeight = 118 mMeasuredWidth = 922 mMinHeight = 0 View.mMinWidth = 0 mNestedScrollingParent = null mNextFocusDownId = -1 mNextFocusForwardId = -1 mNextFocusLeftId = -1 mNextFocusRightId = -1 mNextFocusUpId = -1 mOldHeightMeasureSpec = 1331 mOldWidthMeasureSpec = 1073742746 mOutlineProvider = {ViewOutlineProvider$1@5280} mOverScrollMode = 1 mOverlay = null mPaddingBottom = 29 mPaddingLeft = 10 mPaddingRight = 10 mPaddingTop = 26 mParent = {LinearLayout@5281} "android.widget.LinearLayout{bd21b35 VE..... ........ 0,0-1080,1997 #7f090000 app:id/SignIn_Layout}" mPendingCheckForLongPress = null mPendingCheckForTap = null mPerformClick = null mPointerIcon = null mPrivateFlags = 16812080 mPrivateFlags2 = 1611867688 mPrivateFlags3 = 4 mRecreateDisplayList = false mRenderNode = {RenderNode@5326} mResources = {Resources@5234} mRight = 1001 mRightPaddingDefined = false mRunQueue = null mScrollCache = null mScrollIndicatorDrawable = null mScrollX = 0 mScrollY = 0 mSendViewScrolledAccessibilityEvent = null mSendViewStateChangedAccessibilityEvent = null mSendingHoverAccessibilityEvents = false mStartActivityRequestWho = null mStateListAnimator = null mSystemUiVisibility = 0 mTag = null mTempNestedScrollConsumed = null mTop = 400 mTouchDelegate = null mTouchSlop = 21 mTransformationInfo = {View$TransformationInfo@5327} mTransientStateCount = 0 mTransitionName = null mUnscaledDrawingCache = null mUnsetPressedState = null mUserPaddingBottom = 29 mUserPaddingEnd = -2147483648 mUserPaddingLeft = 10 mUserPaddingLeftInitial = 10 mUserPaddingRight = 10 mUserPaddingRightInitial = 10 mUserPaddingStart = -2147483648 mVerticalScrollFactor = 0.0 mVerticalScrollbarPosition = 0 mViewFlags = 405028865 mWindowAttachCount = 1 shadow$_klass_ = {Class@5076} "class android.support.v7.widget.AppCompatEditText" shadow$_monitor_ = -1998587800 

2 Solutions collect form web for “‘when’语句跳过Android的Kotlin条件”

我已经使用password.text.toString().isNullOrEmpty()来实现所需的结果。
不知道为什么email.text == null作品,但password.text == null不。 欢迎任何建议

如果没有参数提供when使用作为替代的if-else if一切工作正常。 你得到了一个有效的陈述,然后从Kotlin当expression式出来

  • 在kotlin中,如何传递一个MutableList,其中目标需要一个List
  • Kotlin:具有mutable的class实现的不可变属性的接口
  • 如何将数字字符(0-9)转换为数字值?
  • 注释生成的Java源可空性(对于Kotlin)
  • 如何从字符串获得可选的? 和字符串在Kotlin
  • 用父类的实例属性初始化子类Kotlin类的快速方法
  • Kotlin中MutableList和List之间的区别
  • 最佳做法访问kotlin的财产
  • NullPointerException在Kotlin中
  • Java注释在Kotlin项目jar中不可用
  • 项目不会与Kotlin 1.1.3一起构建
  • Kotlin language will be the best programming language for Android.