为Android设置主题Holo.Light Mono

时间:2012-01-19 11:57:27

标签: android visual-studio-2010 mono

我是这个Android开发的新手,我现在正在使用Mono for Android安装之后的HelloM4A项目。

我也注意到Google希望我们使用他们的设计gudide,我在他们使用的指南中找到了一个主题。它被称为Holo Light

现在,如何将该主题添加到我的项目中?我是否需要下载主题,还是手机上的标准主题?

我尝试了这个代码(下面),但确实引发了构建错误,因为我在Error list中找不到错误,所以很奇怪。

[Activity(Label = "HelloM4A", MainLauncher = true, Icon = "@drawable/icon", Theme = "@style/Theme.Holo.Light")]
public class Activity1 : Activity
{
    int count = 1;

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);

        // Get our button from the layout resource,
        // and attach an event to it
        Button button = FindViewById<Button>(Resource.Id.MyButton);

        button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
    }
}

这是我的项目布局:

enter image description here

感谢任何帮助!

1 个答案:

答案 0 :(得分:2)

在你的项目中有一些名称清单文件。 你必须让主题得到下面的活动。

<activity
        android:name="com.aviz.pep.android.ui.classname"
       android:theme="@android:style/Theme.Translucent.NoTitleBar" >
    </activity>

而不是theme.transulent.notilebar 添加您的主题名称,但请确保您使用的是最新的sdk