2012-12-03 3 views
1

상대 레이아웃에서 MvxBindableGridView를 사용하고 있었는데 완벽하게 작동했습니다. 필자는 화면을 다른 장치로 올바르게 확장하기 위해 LinearLayouts를 사용해야 함을 깨달았습니다. 나는 응용 프로그램을의 LinearLayout으로 변경하고 실행할 때의 GridView는 비어 있고 디버그 출력은 약간의 바인딩 오류선형 레이아웃의 MvxBindableGridView가 모든 항목에 바인딩되지 않습니다.

을 보여줍니다
12-03 16:55:38.363 I/MvxBind (2689): 14.25 Failed to create target binding for from ClickCommand to ClickItemSquare 
MvxBind:Warning: 14.25 Failed to create target binding for from ClickCommand to ClickItemSquare 
12-03 16:55:38.363 I/mono-stdout(2689): MvxBind:Warning: 14.25 Failed to create target binding for from ClickCommand to ClickItemSquare 
는 RelativeLayout의에서 완벽하게 작동 할 때이 실패한 이유를

사람이 알고 있나요?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:local="http://schemas.android.com/apk/res/xxxxx" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<RelativeLayout 
    android:id="@+id/layoutresults" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
    <TextView 
     android:id="@+id/textscore" 
     local:MvxBind="{'Text':{'Path':'Score'}}" 
     android:layout_width="50dp" 
     android:layout_height="wrap_content" 
     android:text="0000" 
     android:textColor="#ff60350f" 
     android:textSize="20dp" 
     android:layout_x="25dp" 
     android:layout_y="45dp" 
     android:textStyle="bold" 
     android:gravity="center" 
     android:layout_marginTop="53dp" 
     android:layout_marginLeft="25dp" /> 
    <TextView 
     android:id="@+id/layoutstartnewgame" 
     android:layout_width="100dp" 
     android:layout_height="65dp" 
     android:layout_x="109dp" 
     android:layout_y="23dp" 
     android:textStyle="bold" 
     local:MvxBind="{'Click':{'Path':'StartNewGame'}}" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="27dp" /> 
    <TextView 
     android:id="@+id/texttime" 
     local:MvxBind="{'Text':{'Path':'Time'}}" 
     android:text="00:00" 
     android:textColor="#ff60350f" 
     android:textSize="20dp" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_x="245dp" 
     android:layout_y="45dp" 
     android:textStyle="bold" 
     android:layout_marginTop="53dp" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="23dp" /> 
</RelativeLayout> 
<cirrious.mvvmcross.binding.android.views.MvxBindableGridView 
    android:layout_below="@+id/layoutresults" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:numColumns="4" 
    android:gravity="center" 
    android:listSelector="#00000000" 
    local:MvxItemTemplate="@layout/itemimage" 
    local:MvxBind="{'ItemsSource':{'Path':'Squares'}, 'ClickItemSquare':{'Path':'ClickCommand'}}" 
    android:layout_marginTop="8dp" /> 
</RelativeLayout> 

는 ClickItemSquare 경고가 일부 바인딩이 일어나고 있음을 말하고있다 선형

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:local="http://schemas.android.com/apk/res/xxxxx" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/TabletGameScreen"> 
<LinearLayout 
    android:layout_width="fill_parent" 
    android:orientation="vertical" 
    android:layout_weight=".1" 
    android:gravity="center" /> 
<LinearLayout 
    android:id="@+id/layoutresults" 
    android:orientation="horizontal" 
    android:gravity="center_vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight=".1"> 
    <TextView 
     android:id="@+id/textscore" 
     local:MvxBind="{&apos;Text&apos;:{&apos;Path&apos;:&apos;Score&apos;}}" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:text="0000" 
     android:textColor="#ff60350f" 
     android:textSize="20dp" 
     android:textStyle="bold" 
     android:gravity="center_horizontal" 
     android:layout_gravity="center_vertical" /> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:textStyle="bold" 
     local:MvxBind="{&apos;Click&apos;:{&apos;Path&apos;:&apos;StartNewGame&apos;}}" 
     android:layout_centerHorizontal="true" 
     android:layout_gravity="center_vertical" /> 
    <TextView 
     android:id="@+id/texttime" 
     local:MvxBind="{&apos;Text&apos;:{&apos;Path&apos;:&apos;Time&apos;}}" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:text="00:00" 
     android:textColor="#ff60350f" 
     android:textSize="20dp" 
     android:textStyle="bold" 
     android:layout_gravity="center_vertical" 
     android:gravity="center_horizontal" /> 
</LinearLayout> 
<cirrious.mvvmcross.binding.android.views.MvxBindableGridView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight=".8" 
    android:numColumns="4" 
    android:gravity="center" 
    android:listSelector="#00000000" 
    local:MvxItemTemplate="@layout/itemimage" 
    local:MvxBind="{&apos;ItemsSource&apos;:{&apos;Path&apos;:&apos;Squares&apos;}, &apos;ClickItemSquare&apos;:{&apos;Path&apos;:&apos;ClickCommand&apos;}}" /> 
</LinearLayout> 
+0

더 많은 코드를 제공 할 수 있습니까? 예 : 그 전과 후에 정확히 작동하고 작동하지 않는 것은 무엇입니까? – Stuart

답변

1

로 변경,하지만 ClickCommand가 작동하지 않는. 어떤 작은 정보를 귀하의 질문에이를 바탕으로

... ClickCommand 구현 방법에

  • 봐 - 나는 그것이 Return ImageView instance when i click on the item GridView 기반으로 추측하고있어 -하지만 너무 다른 아무도 도울 수없는 코드입니다 (게시하지 않는 한)
  • 자세한 정보를 얻으려면 바인딩 추적 수준을 Verbose/Diagnostic으로 설정해보십시오 (설정 방법은 MvxBindingTrace를 참조하십시오. 설정할 정적 변수 값이 있습니다)
  • 확인하십시오. 당신은 android : orientation = 'vertical'을 LinearLayout에 가지고 있습니다.
  • ViewModel 목록 항목의 코드 값을 단계별로 시도해보십시오. 그럼 그들이 경우에 당신은
  • 는 그리드 코드로 다시 되 돌리는 시도하고있다 바인딩 알 - 당신이
  • 이 변경 사항에 대한 자세한 내용과 질문을 게시 해보십시오 같은 ClickItemSquare 경고를 볼 수 있습니까 (예를 들어 일부 이전과 코드 후)
+0

Ive는 여러분이 볼 수있는 원본 게시물에 코드를 추가했습니다. 이제 LinearLayout 버전에서 흥미로운 점은 LinearLayout을 RelativeLayout으로 변경하면 다시 표시되고 다시 작동하지만 현재는 레이아웃을 가져올 수 없다는 것입니다. – mdev

+0

이 사실은 Android 디자이너가 실제로 얻은 것과 같은 것을 보여주지 않는 경우였습니다. 눈금보기가 화면과 같은 것처럼 보입니다. Ive는 LinearLayout 버전으로 다시 전환하여 fill 속성이 아닌 fill 속성을 수정하여 화면에 다시 표시합니다. 왜 그리드가 보이지 않을 때 바인딩 오류가 발생했는지 모르겠지만, 최소한 우리는 대답을 가지고 있습니다. – mdev

관련 문제