我有以下活动将主题指定为属性
[Activity(Label = "PermissionsActivity", Theme = "@android:style/Theme.Translucent.NoTitleBar")]
public class PermissionsActivity: Activity
这很有效,但我如何在运行时应用它?也许通过调用SetTheme
在OnCreate
。我可以看到 SetTheme 接受一个资源 ID 整数。我很难为上述主题找到相应的 Xamarin.Android 常量。请帮忙
将您的主题添加style.xml
到 Resource 文件夹下的文件中,而不是从资源中访问它int
<style name="MyTheme" parent="Theme.Translucent.NoTitleBar">
</style>
活动中的设置
this.SetTheme(Resource.Style.MyTheme);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句