API 23 - 二进制XML文件 - 错误膨胀类android.widget.TextView

时间:2016-01-23 17:02:50

标签: android android-layout android-6.0-marshmallow

这是一个着名的错误,但就我而言,它只发生在运行marshmallow的设备上(API 23)。

Genymotion:Nexus 5X,Nexus6P 真实设备:nexus 6P

我确实阅读过处理这个问题的每个主题,但仍然坚持。

即使我删除1或2个文本视图,它仍然在这里

我的布局似乎正确,在预览和API 22< =中显示得很好 在一个Xamarin项目上运行良好的一个API 22< =。

堆栈追踪:

13 05:19:46.179 2253-2253/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test.test, PID: 2253
android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class android.widget.TextView
    at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at com.test.test.adapters.CommentAdapter.onCreateViewHolder(CommentAdapter.java:50)
    at com.test.test.adapters.CommentAdapter.onCreateViewHolder(CommentAdapter.java:22)
    at jp.wasabeef.recyclerview.animators.adapters.AnimationAdapter.onCreateViewHolder(AnimationAdapter.java:40)
    at jp.wasabeef.recyclerview.animators.adapters.AnimationAdapter.onCreateViewHolder(AnimationAdapter.java:40)
    at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5228)
    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453)
    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363)
    at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
    at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
    at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
    at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
    at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:584)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1037)
    at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:747)
    at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:761)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)

这是xml文件:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/ivProfile"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_margin="5dp"
        android:layout_marginEnd="5dp" />

    <TextView
        android:id="@+id/tvUserName"
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="3dp"
        android:layout_toEndOf="@id/ivProfile"
        android:ellipsize="end"
        android:singleLine="true"
        android:text="name"
        android:textColor="@color/primaryColorDark"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/tvMessage"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tvUserName"
        android:layout_marginTop="3dp"
        android:text="content"
        android:layout_toEndOf="@id/ivProfile" />

    <TextView
        android:id="@+id/tvDateCreate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_marginEnd="5dp"
        android:layout_marginTop="4dp"
        android:singleLine="true"
        android:text="date"
        android:textSize="12sp"
        android:textStyle="italic" />
</RelativeLayout>

0 个答案:

没有答案