我有两个项目,一个在.NET 5上,另一个在.NET Core 3.1上。
\n最近,我打开了电子邮件日志记录,每当抛出错误时都会向我发送电子邮件。
\n我时不时地收到一封包含以下错误的电子邮件:
\n[Error] An unhandled exception has occurred while executing the request.\nSystem.Threading.Tasks.TaskCanceledException: A task was canceled.\n at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)\n at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()\n at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()\n at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()\n at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)\n at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)\n\nRun Code Online (Sandbox Code Playgroud)\n问题是,该错误永远不会在本地开发环境中抛出,并且它可能对应于某些网络不稳定,但我不确定从哪里开始寻找。
\n对于跨应用程序的配置,我使用以下初始化来允许将 AppSettings 对象注入到任何类:
\n[Error] An unhandled exception has occurred while executing the request.\nSystem.Threading.Tasks.TaskCanceledException: A task was canceled.\n at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)\n …Run Code Online (Sandbox Code Playgroud) 我想在我的应用程序中实现这种外观:

我在活动中的 xml 代码看起来像这样:
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/toggleGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/button1"
... />
<com.google.android.material.button.MaterialButton
android:id="@+id/button2"
... />
<com.google.android.material.button.MaterialButton
android:id="@+id/button3"
... />
</com.google.android.material.button.MaterialButtonToggleGroup>
Run Code Online (Sandbox Code Playgroud)
我迁移到 androidx,并在我的样式中使用了材质组件,但由于某种原因,我收到一个运行时错误,内容为:
Binary XML file: Error inflating class com.google.android.material.button.MaterialButtonToggleGroup
implementation "com.google.android.material:material:1.0.0"
Run Code Online (Sandbox Code Playgroud)
不过,在com.google.android.material.button.MaterialButton没有组的情况下使用时,它会工作得很好,这意味着我使用了正确的样式和 gradle 实现。
我还尝试以下操作:
androidx.appcompat:appcompat:1.1.0和com.google.android.material:material:1.0.0多次这是我的依赖项(以防其中一些导致某种冲突):
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//Room Persistance Library
def …Run Code Online (Sandbox Code Playgroud) 如何在标签中获得这种外观?
描述我需要的样式的图像
我希望它:
•根据查看的页面更改文本的颜色(我已经通过默认的supportLibrary的Widget TabLayout实现了此功能)
•更改了背景笔触的颜色
•每个选项卡元素之间都有间距(无法通过padding选项实现)
我搜索了图书馆吗,但没有任何有用的细节,实际上,我不知道在搜索栏中键入什么内容。
这种风格的名称是什么?
提前致谢。
tabs android android-layout android-fragments android-studio
android ×2
.net-5 ×1
.net-core ×1
asp.net-core ×1
c# ×1
java ×1
material-components-android ×1
tabs ×1