0

我已经按照 Telerik 文档中的方式设置了 RadSideDrawer。应用程序构建和加载成功,但侧抽屉内容未显示,当尝试滑动屏幕打开侧抽屉应用程序时崩溃并出现以下错误:

An uncaught Exception occurred on "main" thread.
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.FrameLayout.setVisibility(int)' on a null object reference
at com.telerik.android.primitives.widget.sidedrawer.RadSideDrawer.handleOnDown(RadSideDrawer.java:460)
at com.telerik.android.primitives.widget.sidedrawer.RadSideDrawer.onGesture(RadSideDrawer.java:438)
at com.telerik.android.primitives.widget.sidedrawer.RadSideDrawer.onInterceptTouchEvent(RadSideDrawer.java:420)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2109)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2198)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2198)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2198)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2198)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2198)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2403)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1737)
at android.app.Activity.dispatchTouchEvent(Activity.java:2843)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2364)
at android.view.View.dispatchPointerEvent(View.java:9527)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4248)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4101)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3647)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3700)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3666)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3792)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3674)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3849)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3647)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3700)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3666)

这是包 json 文件:

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.app",
    "tns-android": {
      "version": "3.1.1"
    }
  },
  "dependencies": {
    "@angular/animations": "~4.1.0",
    "@angular/common": "~4.1.0",
    "@angular/compiler": "~4.1.0",
    "@angular/core": "~4.1.0",
    "@angular/forms": "~4.1.0",
    "@angular/http": "~4.1.0",
    "@angular/platform-browser": "~4.1.0",
    "@angular/router": "~4.1.0",
    "moment": "^2.18.1",
    "nativescript-angular": "~3.1.0",
    "nativescript-cardview": "^2.0.2",
    "nativescript-loading-indicator": "^2.3.2",
    "nativescript-telerik-ui": "^3.0.4",
    "nativescript-theme-core": "~1.0.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.3.0",
    "tns-core-modules": "~3.1.0",
    "underscore": "^1.8.3",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "babel-traverse": "6.25.0",
    "babel-types": "6.25.0",
    "babylon": "6.17.4",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "~0.5.0",
    "tslib": "^1.7.1",
    "typescript": "~2.2.1"
  }
}

我已经安装nativescript-ng2-drawer-seed并且它工作正常。我错过了一些东西,但我找不到。任何帮助,将不胜感激。谢谢

4

1 回答 1

1

解决了这个问题。只需NativeScriptUISideDrawerModule在您使用侧抽屉的页面模块中导入即可。或者只是把它放在一个 Angular 共享模块中。

于 2017-08-26T08:27:40.643 回答