如何在Xamarin android中以编程方式更改操作栏标题颜色?我在互联网上尝试了很多事情,但我只是找不到方法。
我不想切换到工具栏,因为我不知道它的代码,我也不知道是否有可能使工具栏看起来与下面代码中的动作栏完全相同。
这是我的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Support.V7.App;
using Android.Graphics.Drawables;
using Android.Graphics;
namespace actionbarTitleColor
{
[Activity(Label = "myActivity")]
public class myActivity : Activity
{
protected override void OnCreate(Bundle bundle) {
base.OnCreate(bundle);
SetContentView(Resource.Layout.Rapsolie);
ActionBar.SetHomeButtonEnabled(true);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ColorDrawable colorDrawable = new ColorDrawable(Color.ParseColor("#00b8ff"));
ActionBar.SetBackgroundDrawable(colorDrawable);
}
public override bool OnOptionsItemSelected(IMenuItem item) {
switch (item.ItemId) {
case Android.Resource.Id.Home:
Finish();
return true;
default:
return base.OnOptionsItemSelected(item);
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 在本地运行时,我可以毫无问题地运行“下一个构建”。命令“vercel build”也可以正常工作。但是,一旦我部署到 vercel,当它构建在 vercel 上时,“类型的检查和检查有效性”就会失败。Typescript 设置为严格模式,但在 Vercel 中运行时似乎更加严格,即使它是相同的代码库。
该应用程序基于 create-t3 应用程序。一旦我在 prisma findUnique 查询中添加“select”语句,它就会停止在 vercel 上构建。例如在“check-credentials”文件中。
在vercel的控制台中,会输出以下错误:
info - Linting and checking validity of types...
Failed to compile.
./src/pages/api/user/check-credentials.ts:33:7
Type error: Type '{ id: true; name: true; email: true; image: true; password: true; }' is not assignable to type 'UserSelect'.
Object literal may only specify known properties, and 'password' does not exist in type 'UserSelect'.
31 | email: true,
32 | image: true,
> 33 | password: true,
| ^ …Run Code Online (Sandbox Code Playgroud)