小编m.v*_*ent的帖子

在通知区域切换中收听“深色主题”并收到更改通知

我可以UI_MODE_NIGHT_MASK通过致电resources.configuration.uiMode和来获取Configuration.UI_MODE_NIGHT_MASK

我需要监听这个变量并在接收新值时更改我的主题。

我想我可以添加一个,BroadcastReceiver这样我就可以做一个getSystemService(A_CONSTANT_FROM_Context)并注册一个类似于 的主题回调ConnectivityManager.NetworkCallback。但我只在文档中找到了这些:扩展Theme.MaterialComponents.DayNight我的主题样式并具有values-night. 问题黑暗配置已经有一个可接受的答案,请参阅本文档。

android android-theme android-10.0

4
推荐指数
1
解决办法
2339
查看次数

如何将 Lottie 文件设置为菜单项?

我正在创建底部导航,图标需要是动画 Lottie 文件。似乎不可能为标签编写绑定适配器。有没有什么解决方案可以让我们在底部导航中拥有很多动画?

<item
    android:id="@+id/my_navigation"
    android:icon="@drawable/my_icon"
    android:title="@string/my_text" 
    **app:setLottie=@raw/my_file/>**
Run Code Online (Sandbox Code Playgroud)

xml android menuitem bottomnavigationview lottie

4
推荐指数
1
解决办法
1956
查看次数

在C#中生成迷宫 - 它不显示迷宫

虽然maze.display()此代码中有一个,但我的控制台应用程序的控制台中没有出现任何迷宫.它只是说"按任意键继续..."

来源是http://rosettacode.org/wiki/Maze_generation

这是代码:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Drawing;

namespace MazeGeneration
{
    public static class Extensions
    {
        public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng)
        {
            var e = source.ToArray();
            for (var i = e.Length - 1; i >= 0; i--)
            {
                var swapIndex = rng.Next(i + 1);
                yield return e[swapIndex];
                e[swapIndex] = e[i];
            }
        }

        public static CellState OppositeWall(this CellState orig)
        {
            return (CellState)(((int)orig >> 2) | ((int)orig << 2)) …
Run Code Online (Sandbox Code Playgroud)

c#

2
推荐指数
1
解决办法
861
查看次数