2016-03-07 46 views
1

最近,我使用Android支持库版本23.2.0更新了我的应用程序,并且我看到此库中存在导致应用程序崩溃时导致应用程序崩溃的问题。支持库中的CoordinatorLayout IllegalStateException 23.2.0

这是从GoogleAnalytics中看到的错误。我发现它的Android 6.0,2.3.6和4.4.4至今: IllegalStateException异常(@ CoordinatorLayout $的LayoutParams:resolveAnchorView:2522){}主要

这似乎是在支持库中的错误(和它似乎也影响其他组件)。我已经解决了它返回到版本23.1.1和我的应用程序完美。我没有找到崩溃的原因,但在这里你是导致它的片段。也许你可以看到别的东西。

非常感谢!

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 

    android:id="@+id/linear_lines" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    > 

    <android.support.design.widget.CoordinatorLayout 


     android:id="@+id/coordinator_lines" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:layout_above="@+id/relative_date_text" 

     > 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <android.support.design.widget.TabLayout 
       android:id="@+id/sliding_tabs" 
       style="@style/MyCustomTabLayout" 
       android:layout_width="match_parent" 
       android:layout_height="@dimen/abc_action_button_min_height_material" 
       android:background="@color/blue_soriabus" 
       android:elevation="10dp" 
       /> 

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

       <android.support.v4.view.ViewPager 
        android:id="@+id/vpPager" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        /> 

       <View 
        android:id="@+id/shadow_view" 
        android:layout_width="match_parent" 
        android:layout_height="7dp" 
        android:background="@drawable/toolbar_shadow" /> 

      </RelativeLayout> 

     </LinearLayout> 

     <android.support.design.widget.FloatingActionButton 
      android:id="@+id/floating_button_open_map" 
      app:borderWidth="0dp" 
      app:backgroundTint="@color/blue_soriabus" 
      app:elevation="10dp" 
      android:src="@drawable/ic_map_white_48dp" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom|right|end" 
      android:layout_marginRight="16dp" 
      android:layout_marginBottom="16dp" 
      android:layout_alignParentBottom="true" 
      app:layout_anchor="@id/coordinator_lines" 
      app:layout_anchorGravity="bottom|right|end" 
      /> 

     <android.support.design.widget.FloatingActionButton 
      android:id="@+id/floating_button_open_calendar" 
      app:borderWidth="0dp" 
      app:backgroundTint="@color/blue_soriabus" 
      app:elevation="10dp" 
      android:src="@drawable/ic_calendar_white_36dp" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="90dp" 
      app:layout_anchor="@id/floating_button_open_map" 
      app:layout_anchorGravity="top" 
      android:layout_gravity="top|right|end" 
      /> 

    </android.support.design.widget.CoordinatorLayout> 

    <RelativeLayout 
     android:id="@+id/relative_date_text" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:elevation="10dp" 
     android:background="@color/blue_soriabus_dark" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     > 

     <TextView 
      android:id="@+id/date_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textColor="@color/pure_white" 
      android:layout_centerInParent="true" 
      android:text="Fecha" 
      /> 

    </RelativeLayout> 

</RelativeLayout> 

回答

1

layout_anchor必须是CoordinatorLayout一个孩子,但使用的是coordinator_lines(即你的CoordinatorLayout本身)。

如果您没有特定的孩子,您需要将您的视图锁定,只需使用layout_gravity而不是layout_anchorGravity,并完全删除layout_anchor

+0

哇,那么容易... 我仍然很怀疑为什么这个确实在23.2.0之前工作 –

相关问题