0

MapView をホストするフラグメント アクティビティと、ListView を含む TabView があります。TabView のフラグメントを SlidingDrawer でラップします。問題は、SlidingDrawer を下から上に引き出すと、アプリが常にクラッシュし、Stackoverflow エラーが発生することです。どこが間違っているのかわからず、何を修正する必要があるのか​​もわかりません。誰でも私に解決策を提供できますか? ありがとう

フラグメント XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <fragment android:id="@+id/my_map_fragment1"
              android:name="com.wwh.activities.MyMapFragment"
               android:layout_width="fill_parent"
              android:layout_height="fill_parent" >
          <!-- Preview: layout=@layout/my_map_fragment -->
    </fragment>

   <SlidingDrawer android:id="@+id/drawer" android:handle="@+id/handle"
        android:content="@+id/my_tab_fragment" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:orientation="vertical"
        android:layout_gravity="bottom">

    <fragment android:id="@+id/my_tab_fragment"
              android:name="com.wwh.activities.MyTabFragment"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent" >

    </fragment>


            <ImageView android:id="@+id/handle" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:background="@drawable/list_frame" />

</SlidingDrawer>

</RelativeLayout>

タブビュー XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
        android:layout_width="fill_parent" android:layout_height="fill_parent">



<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost" android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <LinearLayout android:orientation="vertical"
        android:layout_width="wrap_content" android:layout_height="wrap_content">
        <HorizontalScrollView android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:fillViewport="true"
            android:background="@drawable/tab_bg"
            android:scrollbars="none">
        <TabWidget android:id="@android:id/tabs"
            android:layout_width="wrap_content" android:layout_height="wrap_content" />
        </HorizontalScrollView>
        <FrameLayout android:id="@android:id/tabcontent"
            android:layout_width="wrap_content" android:layout_height="wrap_content">       
        </FrameLayout>
    </LinearLayout>
</TabHost>


</LinearLayout>

リストビュー XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#e7eff2"
    >

 <CheckBox
             android:id="@+id/cb_tab_sort"
             android:layout_width="320dp"
             android:layout_height="34dp"
             android:background="@drawable/checkbox_background"
             android:button="@drawable/check_tab_sort" />

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/list_bg"
    >


<ListView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@android:id/list"
    android:cacheColorHint="#00000000"
    android:divider="#ffffff"
    android:dividerHeight="2px"
    />

</LinearLayout>
</LinearLayout>

リスト アイテムの XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@android:color/transparent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="horizontal"
    android:layout_marginBottom="12dp"
    android:layout_marginTop="7dp" 
    android:background="@android:color/transparent" 
    android:gravity="center">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content" android:layout_height="fill_parent" android:orientation="vertical" android:background="@android:color/transparent"
    android:gravity="center" android:layout_marginLeft="5dp"
    android:layout_marginBottom="2dp"
    android:layout_marginTop="2dp">

    <LinearLayout
     android:layout_width="55.33dp"
     android:layout_height="52.67dp"
     android:background="@drawable/list_frame_blank"
     android:padding="5dp"
     >


    <ImageView
    android:id="@+id/image"
    android:layout_width="39.33dp" 
    android:layout_height="41.67dp"
    android:layout_gravity="center"
    android:layout_marginLeft="2.5dp"
    android:layout_marginBottom="5dp"
    />


     </LinearLayout>

     </LinearLayout>

       <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent" 
    android:orientation="vertical">
        <LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal">
        <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txt_title" 
        android:layout_marginLeft="5dp"
        android:textStyle="bold"
        android:textColor="#cc3333"
        android:layout_weight="0.1" 
        android:textSize="20sp"/>

        <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/txt_distance"
        android:textStyle="bold"
        android:textColor="#000000"
        android:textSize="18sp"/>

         <ImageView
        android:layout_width="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="7dp"
        android:layout_marginTop="2dp"
        android:layout_height="wrap_content"
        android:background="@drawable/list_arrow"/>


        </LinearLayout>
        <RelativeLayout 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        >
         <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txt_list_desc"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="5dp"
        android:textColor="#000000"
        android:ellipsize="end" 
        android:singleLine="true"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:textSize="16sp"/>

             <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/txt_more"
            android:maxLength="103"
            android:textColor="#666666"
            android:ellipsize="marquee" 
            android:singleLine="false"
            android:textSize="14sp"
            android:layout_below="@+id/txt_list_desc"
            android:layout_alignLeft="@+id/txt_list_desc"
            />

            <ImageView
            android:id="@+id/list_icon"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="5dp"
            android:layout_height="wrap_content"
            android:background="@drawable/list_icon_historical"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/txt_list_desc"
            android:layout_alignRight="@+id/txt_list_desc"
            />


        </RelativeLayout>         
</LinearLayout>
</LinearLayout>
</LinearLayout>

スタックトレース:

04-26 15:54:34.155: E/AndroidRuntime(13873): FATAL EXCEPTION: main
04-26 15:54:34.155: E/AndroidRuntime(13873): java.lang.StackOverflowError
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.text.Layout.getLineForOffset(Layout.java:880)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.text.Layout$Ellipsizer.getChars(Layout.java:2086)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.text.Layout$Ellipsizer.charAt(Layout.java:2078)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.text.Layout.getLineVisibleEnd(Layout.java:1040)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.text.Layout.draw(Layout.java:270)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.widget.TextView.onDraw(TextView.java:4443)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.View.draw(View.java:6933)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.View.draw(View.java:6936)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.View.draw(View.java:6936)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.widget.AbsListView.dispatchDraw(AbsListView.java:1627)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.widget.ListView.dispatchDraw(ListView.java:3215)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.View.draw(View.java:6936)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.widget.AbsListView.draw(AbsListView.java:3005)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.View.draw(View.java:6936)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.View.draw(View.java:6936)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.widget.SlidingDrawer.dispatchDraw(SlidingDrawer.java:304)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.View.draw(View.java:6936)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1917)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewRoot.draw(ViewRoot.java:1530)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewRoot.performTraversals(ViewRoot.java:1266)
04-26 15:54:34.155: E/AndroidRuntime(13873):    at android.view.ViewRoot.handleMessage(ViewRoot.java:
4

1 に答える 1

0

その要素を埋めるときに例外をキャッチしますandroid:id="@+id/txt_list_desc"android:ellipsize="end"と を使用して TextView に長いテキストを追加または設定するとよく発生しますandroid:singleLine="true"。もっと言うと、アイテムを埋めるコードを見る必要があります。

于 2012-12-14T17:04:51.940 に答える