2013-10-11 49 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); 
相關問題