2015-03-31 128 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> 
相關問題