我試圖從滑動菜單庫中擴展SlidingFragmentActivity
後注入contentview
。但我得到錯誤像@滑動菜單活動中的@ContentView
java.lang.IllegalStateException: Both setBehindContentView must be called in onCreate in addition to setContentView".
但它工作正常,如果我設置onCreate
內的內容。任何人都可以爲此提出解決方案嗎?
我試圖從滑動菜單庫中擴展SlidingFragmentActivity
後注入contentview
。但我得到錯誤像@滑動菜單活動中的@ContentView
java.lang.IllegalStateException: Both setBehindContentView must be called in onCreate in addition to setContentView".
但它工作正常,如果我設置onCreate
內的內容。任何人都可以爲此提出解決方案嗎?
即使使用@ContentView
,您也必須自己撥打setBehindContentView
。 @ContentView
註釋在超類(RoboActivity)的onCreate
中爲您調用setContentView
,但不是setBehindContentView
。
終於讓我找到解決方案,這
setContentView(R.layout.activity_main);
setBehindContentView(menu);
試試這個。它對我有幫助。