0

Я внедрил собственный ListItem для своего 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 для сортировки этого или их быстрого исправления? Я попытался сделать то же, что и выше, но использовал HorizontalScrollScrollView, который работал, но это, вероятно, потому, что ListView ничего не делает с событиями горизонтальной прокрутки.

Любая помощь приветствуется

ответ

1

Набор на сенсорном на вашем у слушателя ScrollView

OnTouchListener childScroll = new View.OnTouchListener() { 

      @Override 
      public boolean onTouch(View v, MotionEvent event) { 
       v.getParent().requestDisallowInterceptTouchEvent(true); 
        return false ; 
      } 
    }; 

 Смежные вопросы

  • Нет связанных вопросов^_^