2016-09-05 7 views
0

私はXamarin.formsを使ってアプリを作っています。 youtubeやAndroid上の任意のGoogleアプリを見ている場合。 選択したタブアイコンのみが強調表示されます。 だから私はそれを適用したい。Xamarin.formsのタブ付きページSetIconがAndroid上で動的に動作しません。

私はXamarin.forms用にAppcompatツールバーを使用しています。

私のコードがある

...

 this.CurrentPageChanged += (sender, e) => 
     { 
      int index = this.Children.IndexOf(this.CurrentPage); 

      Device.BeginInvokeOnMainThread(() => 
      { 
       for (int i = 0; i < this.Children.Count; i++) 
       { 
        NavigationPage navpage = this.Children[i] as NavigationPage; 
        if (navpage != null) 
        { 
         if (i == index) 
          navpage.Icon = "x3_tabbaricon_1" + index; 
         else 
          navpage.Icon = "x3_tabbaricon_2" + index + "_"; 
        } 
       } 
      }); 
     }; 

それは、iOS上で正しく動作しています。 Androidでは何も起こりません。 {ContentPage} .SetIconを呼び出す必要があります。いずれのタブにも影響はありません。

ありがとうございました。

答えて

0

答えました。 私はセレクタをAndroidに使用する必要があります。

関連する問題