BottomSheetBehavior之java.lang.IllegalArgumentException:TheviewisnotassociatedwithBottomSheetBehavior
AndroidRuntime: FATAL EXCEPTION: main Process: me.chunsheng.uberdriver, PID: 13674 java.lang.RuntimeException: Unable to start activity ComponentInfo{me.chunsheng.uberdriver/me.chunsheng.uberdriver.MainActivity}: java.lang.IllegalArgumentException: The view is not associated with BottomSheetBehavior at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2570) at android.app.ActivityThread.access$800(ActivityThread.java:162) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1446) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5528) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:952) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) Caused by: java.lang.IllegalArgumentException: The view is not associated with BottomSheetBehavior at android.support.design.widget.BottomSheetBehavior.from(BottomSheetBehavior.java:710) at me.chunsheng.uberdriver.MainActivity.onCreate(MainActivity.java:27) at android.app.Activity.performCreate(Activity.java:6074) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1117) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2456) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2570) at android.app.ActivityThread.access$800(ActivityThread.java:162) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1446) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5528) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:952) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 09-14 22:52:58.951 13674-13674/me.chunsheng.uberdriver I/Process: Sending signal. PID: 13674 SIG: 9
錯誤資訊如上:view與BottomSheetBehavior不匹配???
這是什麼鬼呢???
由於BottomSheetBehavior填充的view需要為 android.support.design.widget.CoordinatorLayout 的一個子view,這時候,比如view在佈局中為一個相對佈局,需要這樣寫:
<RelativeLayout
android:id="@+id/layout_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@android:color/white"
android:elevation="8dp"
app:behavior_hideable="true"
app:behavior_peekHeight="90dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<TextView
android:id="@+id/text_view_sheet_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/activity_vertical_margin"
android:text="點選叫車,上滑選車"
android:textSize="14sp" />
</RelativeLayout>
注意紅色宣告,這時候用BottomSheetBehavior填充這個view的時候才是正確的.
相關文章
- 使用BottomSheetBehavior實現美團拖拽效果
- java.lang.IllegalArgumentException: Wrong state classsJavaException
- java.lang.IllegalArgumentException at java.sql.Date.getHoursJavaExceptionSQL
- Caused by: java.lang.IllegalArgumentException: port out of range:-1JavaException
- java.lang.IllegalArgumentException: Path index does not start with a "/" charactJavaExceptionIndex
- 解決:java.lang.IllegalArgumentException: String must not be emptyJavaException
- Bug:java.lang.IllegalArgumentException: unknown document format for file:JavaExceptionORM
- Caused by: java.lang.IllegalArgumentException: Unable to instantiate SparkSession with Hive supportJavaExceptionSparkSessionHive
- java.lang.IllegalArgumentException: Could not find class異常解決方式JavaException
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value forJavaExceptionAPPAI
- yml:java.lang.IllegalArgumentException: Could not resolve placeholder ‘jdbc.driverClassName‘JavaExceptionJDBC
- java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy7 implemJavaException
- java.lang.IllegalArgumentException: Unsupported class file major version xx解決之道JavaException
- 問題解決java.lang.IllegalArgumentException at org.springframework.asm.ClassReaderJavaExceptionSpringFrameworkASM
- Android java.lang.IllegalArgumentException: Object returned from onCreateLoader must not be a non-st...AndroidJavaExceptionObject
- weblogic 10.3.3 java.lang.IllegalArgumentException異常終止服務故障WebJavaException
- openfire 部署後報錯: java.lang.IllegalArgumentException: interface xx is not visible from class loaderJavaException
- Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection alreadyErrorAPPXMLJavaException
- 解決java.lang.IllegalArgumentException: 'Content-Type' cannot contain wildcard type '*'異常(真實有效)...JavaExceptionAI
- tomcat使用cookies快取的時候中文報錯解決辦法 java.lang.IllegalArgumentException: Control character in cookie value or attribute.TomcatCookie快取JavaException
- 資訊: 解析 HTTP 請求 header 錯誤 注意:HTTP請求解析錯誤的進一步發生將記錄在DEBUG級別。 java.lang.IllegalArgumentException: 請求頭太大HTTPHeaderJavaException
- oracle之 RAC Interconnect之HAIPOracleAI
- 漢字之美,拼音之韻
- Python基礎之(三)之字典Python
- 設計模式之禪之代理模式設計模式
- 程式碼之美---遞迴之美遞迴
- 科學之抽象管理之提升抽象
- JavaScript之thisJavaScript
- 若之
- 深入Spring之IOC之載入BeanDefinitionSpringBean
- PHP之string之ord()函式使用PHP函式
- 《碼農翻身》之浪潮之巔的WebWeb
- vue 兄弟元件之間傳值之busVue元件
- 架構之爭,體制之惑(1)--產品經理模式之弊論架構模式
- 前端之資料模擬之Mock.js前端MockJS
- 軟體測試江湖之公會武器之爭
- Java常用資料結構之Set之TreeSetJava資料結構
- AI犯錯誰之過?切勿盲目相信之AI