0

我已經像在Telerik文檔中一樣設置了RadSideDrawer。應用程序構建併成功加載,但沒有顯示sidedrawer內容,並試圖輕掃屏幕打開與以下錯誤sidedrawer應用程序崩潰時:當試圖打開抽屜時,Nativescript 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,它工作正常。我失去了一些東西,但我找不到。任何幫助,將不勝感激。謝謝

+0

如果您可以分享您的Page XML/HTML和JavaScript/TypeScript是我們可能能夠找到問題。也許你已經在另一個UI元素旁邊聲明瞭RadSideDrawer,通過設計,RadSideDrawer應該是Page的單個子元素。 –

+0

@VladimirAmiorkov感謝您的幫助。這是我的一個簡單的錯誤。我已經在AppModule中導入了'NativeScriptUISideDrawerModule',但不是在我使用sidedrawer的頁面的模塊中。 – zarax

回答

0

解決了這個問題。只需在您使用sidedrawer的頁面的模塊中輸入NativeScriptUISideDrawerModule即可。或者把它放在一個角度共享模塊中。

相關問題