2011-09-15 43 views
1

我们怎样才能把图像放在monodroid屏幕的标题栏中?我们如何才能把图像放在monodroid屏幕的标题栏中?

我试过使用下面的代码,但它显示错误,因为getwindow()不是一个有效的函数,我无法在monodroid中找到这个有效的等价物。

 Boolean CustomTitleSupported = RequestWindowFeature (WindowFeatures.CustomTitle); 

     SetContentView(Resource.Layout.Search); 

     getwindow().setFeatureInt(WindowFeatures.CustomTitle, Resource.layout.titlebar); 

请大家帮忙,因为android方法似乎不能在mono中工作。

回答

2

在Mono for Android中,很多情况下Java将getXXXX/setXXXX方法转换为名为XXXX的属性,以便更好地与.NET风格保持一致。在这个护理中,getWindow()成为Activity上的Window property

0

以下代码适用于单声道机器人。

这里getwindow()被Greg指出的窗口替换。

Boolean CustomTitleSupported = RequestWindowFeature(WindowFeatures.CustomTitle); 

     SetContentView(Resource.Layout.Search); 

     if (CustomTitleSupported){ 

      Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout.titlebar); 
     }; 
相关问题