我在支持设计库中遵循了新组件NavigationView的教程,无法完成此错误消息:
Error inflating class android.support.design.widget.NavigationView
Run Code Online (Sandbox Code Playgroud)
我试过这里的每一个解决方法
但错误信息仍然存在.
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include layout="@layout/toolbar" android:id="@+id/mainToolBar" />
<fragment android:name="com.ais.cherry.fragment.LoginFragment"
android:id="@+id/loginFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/mainToolBar" />
<fragment android:name="com.ais.cherry.fragment.WaterFallFragment"
android:id="@+id/mainFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/mainToolBar" />
<fragment android:name="com.ais.cherry.fragment.SearchFragment"
android:id="@+id/searchFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/mainToolBar" />
<fragment android:name="com.ais.cherry.fragment.ChatMainFragment"
android:id="@+id/chatMainFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/mainToolBar" />
<fragment android:name="com.ais.cherry.fragment.ProfileFragment"
android:id="@+id/profileFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/mainToolBar" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
app:itemTextColor="#212121"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/drawer" />
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
buildscript {
repositories {
mavenCentral()
maven …
Run Code Online (Sandbox Code Playgroud) <video
ref={(input) => { this.video = input; }}
onError={this.onError}
>
<source src="https://xxx.mp4" type="video/mp4" />
</video>
Run Code Online (Sandbox Code Playgroud)
在进行服务器端渲染时,如果视频src的加载早于onError附加到视频DOM上,则即使发生任何错误也不会调用onError。
标签将具有类似的问题,但是可以通过检查img元素的“ complete”属性来解决,例如此答案,但是视频没有基于MDN文档的相应属性。
HTMLVideoElement有一个'error'属性,但是当我使用它时,即使video标签的src不正确,其值也始终为null。
我也尝试使用HTMLVideoElement的“ readyState”和“ networkState”,但是这两个方法无法帮助您识别video src的加载是否错误或尚未初始化。
你们中有人遇到过同样的情况并解决了吗?预先感谢您的帮助和想法!