在“Shared/NavMenu.razor”中,有类似oi-home或 的图标oi-plus。有没有一个页面可以让我看到所有这些图标和名称?
我搜索了 Google 并找到了https://icons.getbootstrap.com/,但该网站并不代表 ASP.NET Blazor 项目中的图标,因为,例如,如果我在该网站中搜索“下载”,它会显示
但在VS中,自动完成列表只显示两个,并且上面的网站上不存在“data-transfer-download”。
我想要的是背景左边为红色的背景。这样的事情。

我尝试了很多事情(有没有所见即所得的编辑器?我想我已经运行了数百次。)像下面的文章中那样指定宽度无效。 如何指定可绘制项目的宽度和高度
以下文章仅告诉我不能使用百分比,现在如何应用宽度。 Android Drawable:在XML文件中以百分比形式指定形状宽度?
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid
android:color="#FFFFFFFF"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="#55FF0000" />
<size android:width="100px" />
</shape>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud) 我的扩展程序正在修改一些 URL。它工作正常,但现在我想检查设置中是否启用了修改。
chrome.webRequest.onBeforeRequest.addListener
(
modifyUrl,
{urls: ['http://somewebsite/*'], types: ['main_frame']},
['blocking']
);
Run Code Online (Sandbox Code Playgroud)
问题是我不知道如何等待该值。我必须在退出之前获取设置modifyUrl。这可能吗?如果这是 C#,我可能会在ManualResetEvent调用sync.get.
function modifyUrl(details)
{
chrome.storage.sync.get("someSetting",
function (data)
{
//I can get the setting here
}
);
//how to know the setting here?
if(enabled in the setting)
{
return {redirectUrl: some different url};
}
}
Run Code Online (Sandbox Code Playgroud) 这个问题可能很愚蠢但是......为什么?我个人喜欢微软风格,其中{与匹配在同一列}.在我使用的所有语言中,{放置在哪里都没关系.
但在科特林,只有这个有效.
image_view.viewTreeObserver.addOnGlobalLayoutListener{
};
Run Code Online (Sandbox Code Playgroud)
这会导致错误.
image_view.viewTreeObserver.addOnGlobalLayoutListener
{
};
Run Code Online (Sandbox Code Playgroud) 我想要密码切换功能,它似乎TextInputLayout有这个功能,而不是TextInputEditText。但正如您在下面的代码中看到的那样,即使我将高度设置为wrap_content和,如果位于 中,app:hintEnabled="false"的高度TextInputEditText也会更高。将其与外部的高度进行比较。TextInputEditTextTextInputLayoutTextInputEditTextTextInputLayout
由于我不使用该提示动画,因此无需增加TextInputLayout的高度TextInputEditText。如何防止TextInputLayout高度增加TextInputEditText?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<EditText
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="121dp"
android:background="#66FF0000"
android:text="Normal EditText"
android:inputType="textEmailAddress"/>
<android.support.design.widget.TextInputLayout
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="196dp"
app:hintEnabled="false"
app:passwordToggleEnabled="true">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#660000FF"
android:hint="TextInputEditText inside TextInputLayout"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputEditText
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#6600FF00"
android:hint="TextInputEditText"
android:inputType="textPassword"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我创建了自己的布局。我定义了一个“好”属性用于其子视图。
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MyLayout">
<attr name="good" format="boolean" />
</declare-styleable>
</resources>
Run Code Online (Sandbox Code Playgroud)
该属性是这样使用的。它有点像您可以用于android:layout_centerInParenta 的子视图RelativeLayout,尽管我不确定为什么我的视图应该以“app:”开头,而以“android:”开头。
<?xml version="1.0" encoding="utf-8"?>
<com.loser.mylayouttest.MyLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Button
app:good = "true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</com.loser.mylayouttest.MyLayout>
Run Code Online (Sandbox Code Playgroud)
现在我想从孩子们那里读到这个属性。但如何呢?我在网上搜索并尝试了一些方法,但似乎不起作用。
class MyLayout: LinearLayout
{
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
{
setMeasuredDimension(200, 300); // dummy
for(index in 0 until childCount)
{
val child = getChildAt(index);
val aa = child.context.theme.obtainStyledAttributes(R.styleable.MyLayout);
val good = aa.getBoolean(R.styleable.MyLayout_good, false)
aa.recycle();
Log.d("so", "value = $good")
}
}
}
Run Code Online (Sandbox Code Playgroud)
补充:通过评论作为提示,我找到了这个文档,并修改了我的代码,如下所示,现在我得到了我想要的结果。 …
我可以禁用EditText,但是用户将无法更改文本。我试图实现的行为是,如果用户尝试键入某些内容(或任何其他更改方法,例如粘贴),则会显示一条消息,例如“由于某些原因,您无法编辑此文本。”。
起初,我以为我可以使用 显示消息TextWatcher,但似乎无法取消更改。我怎样才能实现我正在寻找的行为?我能想到的唯一方法是以下非常肮脏的方式。
备份 EditText 的文本。当 EditText 更改时,如果
isReverting为 false,则显示消息并设置isReverting为 true。如果isReverting为真,只需将其设置为假。将备份设置为 EditText。
我通过扩展创建了一个自定义复合视图FrameLayout。该视图可以在对话框(等等)上。但是如果我想在视图从屏幕上消失时做一些清理工作,比如用户关闭对话框呢?我可以onDestroy参加某种活动吗?或者我应该让所有者(例如对话框或片段)在其(所有者的)onDestroy或已解除的事件上调用视图的清理方法?
大多数新的 Android 设备现在都提供了在正常主题和某种深色主题之间切换的功能。我在Android模拟器上进行了测试,似乎即使系统设置为深色主题,模拟器也会显示白色通知面板,但在三星设备上,通知面板也会变暗以匹配系统主题。
所以,我的问题是,是否可以使我的自定义通知(Button在LinearLayouta 上RemoteView)与系统主题相匹配?也就是说,当系统使用普通主题时,我想在明亮的背景上显示深色标题,而当系统使用深色主题时,我想在深色背景上显示明亮的标题(与其余的通知),当用户切换主题时,我希望我的通知面板也更改主题。
那可能吗?如果不可能或非常复杂,请告诉我。
我正在测试改变视频的音频增益。我创建了一个示例 HTML 页面,视频文件与 HTML 文件位于同一目录中。没有网络服务器;我刚刚在本地磁盘上创建了该文件并使用 FireFox 打开它。代码如下,但是当我单击按钮时,我得到了
传递给createMediaElementSource的HTMLMediaElement具有跨域资源,该节点将输出静默。
并且音频被静音。我怎样才能解决这个问题?我在这里搜索并找到了这个,答案是“解决方案是将 crossOrigin="anonymous" 属性添加到相应的音频元素。” 但这似乎不起作用。
<script crossOrigin="anonymous">
function gain(value)
{
var vid = document.getElementById("testvideo");
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var gainNode = audioCtx.createGain();
gainNode.gain.value = value;
var source = audioCtx.createMediaElementSource(vid);
...
}
</script>
</head>
<body>
<video id="testvideo" width="640", height="360" controls>
<source src="sample.webm" type="video/mp4" crossOrigin="anonymous"/>
</video>
<div>
<button onclick="gain(2)">Gain 2</button>
</div>
Run Code Online (Sandbox Code Playgroud)