2011-05-04 2 views
0

ListActivity에서 스크롤하는 데 문제가 있습니다. 여기복잡한 ListActivity 스크롤하지 않습니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    style="@style/DefaultBackground" 
    android:orientation="vertical"> 

    <include layout="@layout/default_header" /> 

    <ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent" 
     android:fillViewport="true"> 
     <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <LinearLayout style="@style/RoundedCornerContainer" android:orientation="vertical"> 

       <TextView android:text="@string/is_anyone_injured" style="@style/DefaultText.RoundedContainerImmediateChild" /> 
       <Button android:id="@+id/accident_help_call_911_btn" android:text="@string/call_911" 
        style="@style/BaseButton.Large" />      
       <View style="@style/LandingPageChoiceDivider" /> 

       <TextView android:text="@string/review_accident_checklist" style="@style/DefaultText.RoundedContainerImmediateChild" /> 
       <Button android:id="@+id/accident_help_checklist_btn" android:text="@string/checklist" 
        style="@style/BaseButton.Large" />      
       <View style="@style/LandingPageChoiceDivider" /> 

       <TextView android:text="@string/collect_accident_info" style="@style/DefaultText.RoundedContainerImmediateChild" /> 
       <Button android:id="@+id/accident_help_add_accident_btn" android:text="@string/add_new_accident" 
        style="@style/BaseButton.Large" /> 

      </LinearLayout> 

      <LinearLayout style="@style/RoundedCornerContainer" android:orientation="vertical"> 
       <TextView android:text="@string/previous_accidents" style="@style/LabelValueTitle" /> 
       <View style="@style/LandingPageChoiceDivider" /> 

       <ListView android:id="@id/android:list" android:layout_width="fill_parent" 
        android:layout_height="fill_parent" android:drawSelectorOnTop="false" /> 

       <TextView android:id="@id/android:empty" android:layout_width="fill_parent" 
        android:layout_height="fill_parent" android:text="@string/no_previous_claims_found" />      

      </LinearLayout>   
     </LinearLayout> 
    </ScrollView> 

</LinearLayout> 

그리고 내 ListActivity입니다 : 당신이 볼 수 있듯이

public class AccidentHelp extends BaseListActivity { 

    private static final String TAG = "AccidentHelp"; 

    private PreviousClaimAdapter previousClaimsAdapter; 
    private List<AccidentInfo> previousClaimList = new ArrayList<AccidentInfo>(); 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     Log.v(TAG, "onCreate called"); 
     super.onCreate(savedInstanceState); 

     setContentView(R.layout.accident_help); 
      // code for setting up button OnClickListeners here. 
    } 

    @Override 
    public void onResume() { 
     super.onResume(); 
     setupPreviousClaimsAdapter(); 
    } 

    private void setupPreviousClaimsAdapter() { 

     AccidentInfoDB db = new AccidentInfoDB(getApplicationContext()); 

     previousClaimList = db.read(currentUser.getUserName()); 
     //there were no previous accidents. 
     if (previousClaimList == null) { 
      return; 
     } 
     previousClaimsAdapter = new PreviousClaimAdapter(this, R.layout.previous_claim_row, previousClaimList); 

     setListAdapter(previousClaimsAdapter); 
     getListView().setSelector(R.drawable.landing_choice_selector); 
     getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { 

      @Override 
      public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 
       Log.v(TAG, "previous claim selected."); 

       AccidentInfo accidentInfo = (AccidentInfo)getListAdapter().getItem(position); 
       Intent intent = new Intent(AccidentHelp.this, ClaimLandingPage.class); 
       intent.putExtra(ClaimLandingPage.CLAIM_LANDING_PAGE_ACCIDENT_INFO_EXTRA_NAME, accidentInfo); 
       startActivity(intent);     
      } 
     }); 

    } 
} 

것은, 내가 원하는 헤더를 제외하고 페이지의 모든 내용이 스크롤 될 여기 레이아웃입니다. 나는 비 ListActivities에서 이것을 성공적으로 수행했다. 그러나이 레이아웃에서는 페이지를 전혀 스크롤 할 수 없습니다.

데이터를 하위 활동으로 업데이트 할 수 있으므로 onResume 목록을 업데이트하고 있습니다. 상관없이 onCreate로 이동하면 차이가없는 것처럼 보입니다.
ScrollView을 제거하면 레이아웃의 ListView 부분 만 스크롤 할 수 있습니다. 하지만 전체 페이지를 스크롤하고 싶습니다. 어떤 추천?

답변

관련 문제