当我在Drawyerlayout中使用时,swiperefreshlayout崩溃

时间:2014-07-09 07:11:31

标签: android drawerlayout swiperefreshlayout

我已经实现了SwipeRefreshLayout并在新设备(Os 4.0及更高版本)中成功运行。但是当我尝试使用版本2.3.5时,force close dialog正在显示。我在SwiperefreshLayout内实施了DarawyerLayout。 你能否建议我在同一活动中使用其他一些想法。

感谢您的帮助

这是我的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>

日志cat错误

    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 个答案:

答案 0 :(得分:-1)

您的SwipeRefreshLayout是主屏幕(意思不是抽屉菜单)吗? 如果是这种情况,您可能希望在那里使用片段。 您的主要活动将处理菜单,而片段将处理SwipeRefreshLayout。