0

ListView にカスタム ListItem を実装しました。ListItem は次のようになります。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rlOfferRoot"
    android:layout_width="fill_parent"
    android:layout_height="60dp"
    android:padding="5dp"
    android:background="@color/white">


      <RelativeLayout
        android:id="@+id/rlOfferDetails"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#000000">

        <LinearLayout
          android:id="@+id/llOfferRoot"
          android:layout_width="fill_parent"
          android:layout_height="200dp"
          android:orientation="vertical"
          android:background="@color/orange">
            <ImageView
              android:id="@+id/imgOfferImage"
              android:layout_width="fill_parent"
              android:layout_height="match_parent"/>
        </LinearLayout>
        <LinearLayout
          android:id="@+id/menuDrawerLayer"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="bottom"
          android:layout_gravity="bottom">

        <SlidingDrawer
          android:id="@+id/sdOfferDetails"
          android:layout_width="fill_parent"
          android:layout_height="200dp"
          android:layout_alignBottom="@id/imgOfferImage"
          android:content="@+id/drawerButtons"
          android:handle="@+id/slideHandleButton"
          android:topOffset="-50dp">

            <Button
               android:id="@+id/slideHandleButton"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:background="@drawable/arrowup"/>

            <RelativeLayout
              android:id="@+id/drawerButtons"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="#80000000">
              <ScrollView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:scrollbars="vertical"
                android:padding="10dp"
                android:focusable="true">
                <TextView
                  android:id="@+id/txtOfferDetails"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:textColor="@color/white"
                  android:text="This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text
                           This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text
                           This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text
                           This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text end
                           This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text end
                           This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text end
                           This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text end
                           This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text end
                           This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text This is some text end"/>
              </ScrollView>
        </RelativeLayout>
      </SlidingDrawer>
    </LinearLayout>

  </RelativeLayout>
  </RelativeLayout>

これは見栄えがよく、SlidingDrawer を開いて TextView に含まれるテキストをスクロールしようとした場合を除いて、期待どおりに動作します。

TextView のスクロールバーが一瞬表示されるので、TextView はフォーカスを取得しているように見えますが、その後、ListView がフォーカスを取得したように見え、リスト全体がスクロールを開始します。

これを並べ替えるためにカスタム ListView を実装する必要がありますか、それとも簡単な修正ですか? 上記と同じことを試みましたが、動作する Horizo​​ntalScrollScrollView を使用しましたが、これはおそらく ListView が水平スクロール イベントで何もしないためです。

どんな助けでも大歓迎

4

1 に答える 1

1

ScrollView のタッチ リスナーに設定します

   OnTouchListener childScroll = new View.OnTouchListener() {

           @Override
           public boolean onTouch(View v, MotionEvent event) {
                 v.getParent().requestDisallowInterceptTouchEvent( true);
                  return false ;
          }
   };
于 2012-09-18T10:34:25.640 に答える