2013-08-06 3 views
1

다음과 같은 문제로 고생하고 있습니다.listView의 가로 스크롤

세로보기 및 세로보기 기능이있는 목록보기를 만들고 싶습니다. 이미지는 목록보기에서 행 항목을 표시합니다. 모든 것이 일반 목록보기처럼 작동해야합니다. 수직으로 스크롤하는 기능.

제목 (Teszt Elk Nev) 외에 행의 나머지 데이터도 가로로 스크롤해야합니다. (이미지에서 볼 수 있듯이 - 두 번째 행) 목록보기의 모든 행을 수평으로 스크롤하면 수평으로 scrool해야하므로 모든 행의 수평 스크롤 위치는 동일합니다.

enter image description here

나는 몇 시간이 그것을 해결하려고 보냈다. 지금까지 가장 좋은 해결책은 수평 스크롤입니다. 행 항목 레이아웃을위한 코드입니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" > 

    <TextView 
     android:id="@+id/tvOne" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="10dp" 
     android:layout_marginRight="30dp" 
     android:text="one" /> 

    <com.example.testproject.CustomHorScroll 
     android:id="@+id/myHorScroll" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <LinearLayout 
      android:id="@+id/myLay" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" > 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_margin="70dp" 
       android:text="two" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_margin="70dp" 
       android:text="three" /> 

      <!-- rest items goes here --!> 
     </LinearLayout> 
    </com.example.testproject.CustomHorScroll> 

</LinearLayout> 

나는 수평 scrool 운동을 처리하고 horizontalscroolView.scrolBy을 설정하는 목록보기의 모든 행에 전파 할 (X, 0). 하지만 제대로 작동하지 않습니다. :/

또 다른 아이디어는 목록보기를 건너 뛰고 스크롤보기 및 horizontalScroll을 사용하여 사용자 정의 레이아웃을 만드는 것입니다.

도움이 될 것입니다.

답변

0
당신은 아마 사용 보길 원하는

두 가지 방법 :

가장 좋은 방법은 내부에있는 ScrollView 또는 HorizontalScrollView 및 목록을 포함하는있는 LinearLayout (또는 다른 스크롤 항목)과 같은 것을 사용하는 아마 listview 라이브러리.

https://github.com/lucasr/twoway-view