2015-03-31 96 views
1

我在我的项目中使用umano's SlidingUpPanel library,但是当我尝试运行该应用程序时,引发了一个InflateException错误膨胀类com.sothree.slidinguppanel.SlidingUpPanelLayout

android.view.InflateException: Binary XML file line #1: Error inflating class com.sothree.slidinguppanel.SlidingUpPanelLayout 

这是我的布局

<com.sothree.slidinguppanel.SlidingUpPanelLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/bg_main" 
    android:layout_gravity="bottom"> 

    <CalendarView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <!-- other layout --> 
    </RelativeLayout> 
</com.sothree.slidinguppanel.SlidingUpPanelLayout> 

这是我依赖的gradle

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile('com.google.android.gms:play-services:6.1.71') { 
     exclude module: 'support-v4' 
    } 
    compile 'com.sothree.slidinguppanel:library:3.0.0' 
    compile 'com.google.guava:guava-collections:r03' 
    compile 'com.roomorama:caldroid:1.1.8' 
} 

我做了什么错?

+0

你能找到的logcat的STRACK痕迹?一般来说,还有更多关于哪里出错的更多细节。基于我所能看到的,它看起来像你可能忘记了设置强制属性'android:gravity =“bottom | top”(选择一个),或者你可能将它与当前设置的android:layout_gravity = “底部”属性? – 2015-03-31 07:27:01

+0

你是对的@MH。我用自动完成,所以我没有真正注意。您能否将您的评论移至回答部分,以便我可以标记它? – Mark 2015-03-31 07:37:14

回答

5

按照先前的评论:

根据我所看到的,它看起来像你可能已经忘记了设置的强制属性android:gravity="bottom|top"(任选其一),或者你当前设置android:layout_gravity="bottom"属性混合起来?

正确的重力属性应设置有点像这样:

<com.sothree.slidinguppanel.SlidingUpPanelLayout 
    ... 
    android:gravity="bottom" 
    ... 
> 

... 

</com.sothree.slidinguppanel.SlidingUpPanelLayout> 
相关问题