2013-10-11 38 views
1

我无法访问MvxListView的EmptyView属性。任何想法我在这里想念什么?MvvmCross MvxListView EmptyView为空,即使列表为空时也不显示

我的布局代码:

<Mvx.MvxListView 
     android:id="@+id/listview" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     local:MvxBind="ItemsSource Items" 
     local:MvxItemTemplate="@layout/listelement" /> 
<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@android:id/empty"> 
    <TextView 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="5dp" 
     android:layout_marginRight="5dp" 
     android:id="@+id/emptyTextView" 
     android:text="Hello World" 
     android:layout_centerInParent="true" /> 
</RelativeLayout> 

,当我尝试访问EmptyView,它为空。这是我试过的:

var list = FindViewById<MvxListView>(Resource.Id.listview); 
list.EmptyView.FindViewById<TextView>(Resource.Id.emptyTextView); //EmptyView is null here 

在此先感谢!

+3

请问http://stackoverflow.com/a/6135729/373321有帮助吗? - 如果是这样,那么请upvote :) :) – Stuart

+0

谢谢,它definetly帮助:) – Roosevelt

回答

0

只需指定您的TextViewEmptyView

this.listView.EmptyView = (Android.Widget.TextView)FindViewById(Resource.Id.emptyTextView); 
相关问题