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 回答