2014-07-09 48 views
1

我已經實現了SwipeRefreshLayout,並在新設備(Os 4.0及更高版本)中成功運行。但是當我嘗試版本2.3.5 force close dialog顯示。我在DarawyerLayout內實施了SwiperefreshLayout。 你可以建議我一些其他的想法,在同一個活動中使用兩個。swiperefreshlayout當我在Drawyerlayout內部使用時崩潰

提前感謝幫助我

這是我的XML設計...

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/swipe_container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <LinearLayout 
      android:id="@+id/mainLayout" 
      style="@style/fillParent" 
      android:animateLayoutChanges="true" 
      android:background="#D3D5DA" 
      android:cacheColorHint="#00000000" 
      android:fadingEdge="none" 
      android:orientation="vertical" > 

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

       <LoadMoreListView 
        android:id="@+id/list" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:divider="@null" 
        android:footerDividersEnabled="false" 
        android:headerDividersEnabled="false" 
        android:listSelector="@android:color/transparent" 
        android:scrollingCache="true" /> 

       <LinearLayout 
        android:id="@+id/sticky_header" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" 
        android:visibility="gone" > 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:orientation="horizontal" 
         android:weightSum="3" > 

         <TextView 
          android:id="@+id/track_sticky" 
          android:layout_width="0dp" 
          android:layout_height="wrap_content" 
          android:layout_weight="1" 
          android:background="@drawable/color_selector_orange" 
          android:gravity="center_horizontal" 
          android:paddingBottom="10dp" 
          android:paddingTop="10dp" 
          android:text="LOG" 
          android:textColor="#ffffff" 
          android:textSize="@dimen/text_title_medium" /> 

         <TextView 
          android:id="@+id/earn_sticky" 
          android:layout_width="0dp" 
          android:layout_height="wrap_content" 
          android:layout_weight="1" 
          android:background="@drawable/color_selector_green" 
          android:gravity="center_horizontal" 
          android:paddingBottom="10dp" 
          android:paddingTop="10dp" 
          android:text="EARN" 
          android:textColor="#ffffff" 
          android:textSize="@dimen/text_title_medium" /> 

         <TextView 
          android:id="@+id/share_sticky" 
          android:layout_width="0dp" 
          android:layout_height="wrap_content" 
          android:layout_weight="1" 
          android:background="@drawable/color_selector_blue" 
          android:gravity="center_horizontal" 
          android:paddingBottom="10dp" 
          android:paddingTop="10dp" 
          android:text="CONNECT" 
          android:textColor="#ffffff" 
          android:textSize="@dimen/text_title_medium" /> 
        </LinearLayout> 

        <View 
         android:id="@+id/viewDropShadowBottom" 
         android:layout_width="fill_parent" 
         android:layout_height="5dp" 
         android:alpha="0.5" 
         android:background="@drawable/drop_shadow_sticky_header_bottom" 
         android:fadingEdge="horizontal" 
         android:fadingEdgeLength="10dp" /> 
       </LinearLayout> 

       <ImageView 
        android:id="@+id/mPointsImage" 
        android:layout_width="45dp" 
        android:layout_height="45dp" 
        android:layout_alignParentRight="true" 
        android:layout_centerHorizontal="true" 
        android:layout_marginRight="10dp" 
        android:layout_marginTop="100dp" 
        android:adjustViewBounds="true" 
        android:visibility="gone" /> 
      </RelativeLayout> 
     </LinearLayout> 
    </android.support.v4.widget.SwipeRefreshLayout> 

    <include layout="@layout/drawer_menu_layout" /> 

</android.support.v4.widget.DrawerLayout> 

日誌貓錯誤是

07-09 12:53:58.654: E/AndroidRuntime(5541): FATAL EXCEPTION: main 
07-09 12:53:58.654: E/AndroidRuntime(5541): java.lang.StackOverflowError 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.text.Styled.measureText(Styled.java:430) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.text.Layout.measureText(Layout.java:2065) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.text.Layout.getLineMax(Layout.java:1020) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.text.Layout.draw(Layout.java:612) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.widget.TextView.onDraw(TextView.java:4322) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:6970) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:6973) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:6973) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.support.v4.view.ViewPager.draw(ViewPager.java:2176) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:6973) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:6973) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.widget.AbsListView.dispatchDraw(AbsListView.java:1480) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.widget.ListView.dispatchDraw(ListView.java:3186) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:7082) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.widget.AbsListView.draw(AbsListView.java:2588) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:6973) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:6973) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.support.v4.widget.SwipeRefreshLayout.draw(SwipeRefreshLayout.java:326) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:928) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.buildDrawingCache(View.java:6693) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.getDrawingCache(View.java:6475) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1657) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.View.draw(View.java:6973) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.widget.FrameLayout.draw(FrameLayout.java:357) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1997) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewRoot.draw(ViewRoot.java:1600) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1321) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1957) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.os.Handler.dispatchMessage(Handler.java:99) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.os.Looper.loop(Looper.java:150) 
07-09 12:53:58.654: E/AndroidRuntime(5541):  at android.app.ActivityThread.main(Acti 
+1

您可以發佈您的logcat消息一次。 –

+1

我以前也有這個問題,因此試圖使用ActionBar PullToRefresh ...但最終我更新SDK後返回到google的swiperefreshlayout,你知道什麼?!它突然開始工作,所以......如果可以的話,再試一次 –

回答

-1

是您SwipeRefreshLayout主屏幕(意爲不抽屜菜單)? 如果是這樣的話,你可能想在那裏使用一個片段。 你的主要活動將處理菜單,而片段將處理SwipeRefreshLayout。

相關問題