2012-03-27 6 views
1

나는이 문제에 지금 어려움을 겪고있다. 매주 요일별 정보가 포함 된 5 개의 확장 가능한 목록보기가 있으며, 그 중 한 곳에서 스 와이프 할 수 있습니다. 모든 것은 잘 작동하지만, 내가 현재 목록보기가 자동으로 (사용자가 아님) 현재 날짜까지 스크롤되기를 바라는 것을 제외하고는 활동을 시작합니다. 그리고 ... 아무 일도 일어나지 않습니다.ExpandableListView cant 자동 스크롤

는 SSCCE :

public void Test() 
      { 

       for (int i = 0; i < this.numberOfWeeks; i++) 
       { 
        // Relative layout to represent the current visible area 
        RelativeLayout screen = new RelativeLayout(this); 

        //LayoutParameters for the screen, fills the whole screen 
        RelativeLayout.LayoutParams newParams = new RelativeLayout.LayoutParams(
        RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent); 
        screen.Id = 1000; 
        screen.LayoutParameters = newParams; 


        //An ExpandableListView is created with some parameters not important for this example 
        ExpandableListView newEListView = this.CreateExpandableListView(//..params..//) 

        screen.AddView(newEListView); 

        // Set this newEListView to the array of expandablelistviews 
        this.expandableListViews[i] = newEListView; 
       } 

       // Some more stuff is done, and finally when data is loaded and everything shows up just fine.. 
       // Lets make it automatically scroll down to the current day! 

       // This does nothing 
       this.expandableListViews[3].SetSelection(4); // 4 is current day 

       // Same here 
       this.expandableListViews[3].SetSelectionFromTop(4, 200); 

      } 

답변

0

SetSelection 이런 식으로 작동하지 않습니다 .. 수동 스크롤이 잘 작동하는지 언급 할 가치가있을 수도, 당신이 시도 할 수있는 무엇에 대한 대체는

mexpandableList.smoothScrollToPosition(groupPosition); 
입니다

원하는 경우 선택한 행의 배경색을 강조 표시되도록 설정하십시오.

+0

Monodroid에는 그런 방법이 없습니다. : –

+0

http://androidapi.xamarin.com/?link=M%3aAndroid.Widget.AbsListView.SmoothScrollToPosition%28System.Int32%29 – jpobst