如何在单屏幕的标题栏中放置图像?
我尝试使用以下代码,但它显示错误,因为getwindow()在这里不是一个有效的函数,我无法在monodroid中找到有效的等效函数。
Boolean CustomTitleSupported = RequestWindowFeature (WindowFeatures.CustomTitle);
SetContentView(Resource.Layout.Search);
getwindow().setFeatureInt(WindowFeatures.CustomTitle, Resource.layout.titlebar);
请帮助,因为android方法似乎不工作在单声道
在Android的Mono中,很多情况下Java的getXXXX/setXXXX方法会被转换为名为XXXX的属性,以便更好地与。net的风格保持一致。在这种情况下,getwwindow()成为Activity的Window属性。
下面的代码为我在Mono-droid。
这里getwwindow()被Greg指出的window代替了。
Boolean CustomTitleSupported = RequestWindowFeature(WindowFeatures.CustomTitle);
SetContentView(Resource.Layout.Search);
if (CustomTitleSupported){
Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout.titlebar);
};