2013-01-09 4 views
0

저는 레이아웃에 3 개의 MvxBindableListView 위젯을 성공 시키려고했습니다. 각 MvxBindableListView가 내부 스크롤없이 완전히 표시되고 내 "페이지"를 스크롤 할 수 있도록 이렇게하는 방법이 있습니까?하나의 레이아웃에 여러 개의 MvxBindableListView가 있습니까?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:local="http://schemas.android.com/apk/res/MyCurrentProject.Client.UI" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="10dp"> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      local:MvxBind="{}" /> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      local:MvxBind="{}" /> 
     <Mvx.MvxBindableListView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:clickable="false" 
      local:MvxBind="{}" /> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      local:MvxBind="{}" /> 
     <Mvx.MvxBindableListView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:clickable="false" 
      local:MvxBind="{}" /> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      local:MvxBind="{}" /> 
     <Mvx.MvxBindableListView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:clickable="false" 
      local:MvxBind="{}" /> 
    </LinearLayout> 
</LinearLayout> 

여기 빈 바인딩 수 있지만 완전히 작업 : 이 레이아웃입니다. 목록에는 다양한 요소가 있으므로 고정 된 높이를 사용할 수 없습니다.

미리 감사드립니다!

답변

2

체크 아웃 MvxBindableLinearLayout -하지만 하나 이상의 긴 목록을 전체적으로 표시하는 경우 많은 추가 리소스 (메모리, 그래픽 개체 등)를 사용할 수 있다고 생각하십시오.

+0

스크롤하지 않고 ScollView를 사용할 수 있도록 MvxBindableListViews의 높이를 목록의 전체 크기로 설정하는 방법이 없습니까? – Ivozor

+0

안드로이드 워드 프로세서 – Stuart

+0

에서 wrap_content를 확인해 보았습니다. 목록의 높이를 1 목록 항목의 높이로 설정했습니다 ... 그리고 목록이 여전히 스크롤 가능합니다 ... ( – Ivozor

1

트릭을 사용하면 목록이 커지고 스크롤보기 안에 배치 할 수 있습니다. 아래 코드를 참조하십시오. 일반 MvxBindableListView와 같은 방식으로 소비합니다.

public class BindableExpandableHeightListView : MvxBindableListView 
{ 
    public BindableExpandableHeightListView(Context context, IAttributeSet attrs) : base(context, attrs) { } 

    public BindableExpandableHeightListView(Context context, IAttributeSet attrs, MvxBindableListAdapter adapter) : base(context, attrs, adapter) { } 

    private bool _isExpanded = true; 

    protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) 
    { 
     if (_isExpanded) 
     { 
      int expandSpec = MeasureSpec.MakeMeasureSpec(int.MaxValue >> 2, MeasureSpecMode.AtMost); 
      base.OnMeasure(widthMeasureSpec, expandSpec); 

      ViewGroup.LayoutParams layoutParams = LayoutParameters; 
      layoutParams.Height = MeasuredHeight; 
     } 
     else 
     { 
      base.OnMeasure(widthMeasureSpec, heightMeasureSpec); 
     } 
    } 

} 
+0

Alexey에게 감사하지만 Stuart의 방법을 사용하여 끝내 었습니다 ...;) – Ivozor

관련 문제