我在Mac上使用Visual Studio Community 2017,运行程序时输出窗口没有出现,我什至不知道如何重置设置,我想我没有碰过任何设置,但显然发生了什么。我删除并重新安装了Visual Studio,但仍然无法正常工作。
我正在尝试使用角度材质表。我导入了该模块,但出现模板解析错误。HTML:
<mat-table [dataSource]="dataSource">
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef> Name </mat-header-cell>
<mat-cell *matCellDef="let project">{{project.name}}</mat-cell>
</ng-container>
<ng-container matColumnDef="key">
<mat-header-cell *matHeaderCellDef> Key </mat-header-cell>
<mat-cell *matCellDef="let project">{{project.Key}}</mat-cell>
</ng-container>
<ng-container matColumnDef="reason">
<mat-header-cell *matHeaderCellDef> reason </mat-header-cell>
<mat-cell *matCellDef="let project">{{project.reason}}</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; column: displayedColumns;"></mat-row>
</mat-table>
Run Code Online (Sandbox Code Playgroud)
组件中的导入:
import { Component, OnInit } from '@angular/core';
import {Observable} from "rxjs"
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { ProjectService } from '../services/project.service';
import { UserService } from '../services/user.service';
import { Subject } from 'rxjs/Subject';
import { …Run Code Online (Sandbox Code Playgroud) 我在反应项目中有选项卡组件。
我有 2 个标签。选项卡 1 和选项卡 2。当用户单击选项卡 1 的包含以选择我想将活动选项卡从选项卡 1 更改为选项卡 2 时。
例如。
我有两个选项卡 Tab1 和 Tab2。Tab1 包含 test1 和 test 2。Tab2 包含 test3 和 test4。
当用户单击 test1 (Tab1 的包含)时,我想将活动选项卡从 Tab1 更改为 Tab2。
我该怎么做。
我想在 Material2 中过滤多个 选择。
为此,我尝试在mat-option类似的东西上使用一个简单的过滤器管道:
transform() { ... return value.filter(v => v.value === argtext); }
问题来了,
首先,我选择一些项目。
然后,我按关键字过滤我过滤了新项目。
现在我可以看到我之前的选择丢失了。
这是因为每次过滤器更改选项时,材料都会构建选项。并且每次也清除选择。所以我使用管道的想法对我不起作用。
感谢阅读/帮助
我目前计划在我的应用中实施动态通知设置。如果当前设备运行的是 Android Oreo,则显示通知渠道设置。如果不是 Android Oreo,则显示另一个设置 ( PreferenceCategory)
这是我的代码片段,用于在设备版本不是 Oreo 时显示:
for (MyNotificationChannel notificationChannel : notificationChannels) {
System.out.println("Notification channel created at index " + notificationChannel.getIndex());
PreferenceCategory preferenceCategory = new PreferenceCategory(preferenceScreen.getContext());
preferenceCategory.setTitle(notificationChannel.getNotificationTitle());
preferenceCategory.setSummary(notificationChannel.getNotificationDesc());
SwitchPreference enableNotificationPreference = new SwitchPreference(preferenceScreen.getContext());
enableNotificationPreference.setDefaultValue(true);
enableNotificationPreference.setTitle("Enable notification channel");
enableNotificationPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
System.out.println("Preference change: " + newValue);
return true;
}
});
preferenceCategory.addPreference(enableNotificationPreference);
SwitchPreference enableVibratePreference = new SwitchPreference(preferenceScreen.getContext());
enableVibratePreference.setTitle("Vibrate");
enableVibratePreference.setSummary("Whether to vibrate when there are notifications available");
enableVibratePreference.setDefaultValue(true);
enableVibratePreference.setIcon(R.drawable.ic_vibrate_white_24dp);
enableVibratePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() …Run Code Online (Sandbox Code Playgroud) 我想向我的应用程序添加一个对话框,但是由于某种原因它没有显示。
对话框组件:
import { Component, OnInit } from '@angular/core';
import {MatDialogRef} from "@angular/material";
@Component({
selector: 'app-connect-to-player-dialog',
templateUrl: './connect-to-player-dialog.component.html',
styleUrls: ['./connect-to-player-dialog.component.css']
})
export class ConnectToPlayerDialogComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Run Code Online (Sandbox Code Playgroud)
使用的方法:
connectToPlayer() {
const dialogConfig = new MatDialogConfig();
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
this.dialog.open(ConnectToPlayerDialogComponent, dialogConfig);
}
Run Code Online (Sandbox Code Playgroud)
我还将对话框添加到entryComponents:
entryComponents: [ConnectToPlayerDialogComponent]
Run Code Online (Sandbox Code Playgroud)
我不知道可能会丢失什么...谢谢您的帮助!
完整代码:
import {Component, OnInit} from '@angular/core';
import {PLAYERS} from '../mock-players';
import {Router} from "@angular/router";
import {AlertService, AuthenticationService} from "../_services";
import {HttpClient} from "@angular/common/http"; …Run Code Online (Sandbox Code Playgroud) 我是Angular Material的新手.有没有办法覆盖材质表中的mat-header-arrow.我试图让mat-sort-header-container显示:none.但遗憾的是它没有用.
目前的行为:
预期行为:
任何帮助都非常感谢.
谢谢
这是我的用户表格:
我有一个问题,输入字段的颜色是白色,背景是相同的白色。我在任何地方都找不到如何更改输入字段的颜色。
彩色文本的属性css是什么?
这是我的模板:
<div class="example-container" style="color:red">
<mat-form-field>
<input matInput placeholder="Input">
</mat-form-field>
<mat-form-field>
<textarea matInput placeholder="Textarea"></textarea>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Select">
<mat-option value="option">Option</mat-option>
</mat-select>
</mat-form-field>
</div>
new contact
Run Code Online (Sandbox Code Playgroud) 如何使文本小写MaterialButton呢?textAllCaps="false"对我不起作用。我在用com.google.android.material:material:1.0.0-alpha3
<com.google.android.material.button.MaterialButton
android:id="@+id/material_button"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_label_enabled"/>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用谷歌开发的Material Button.由于第三方依赖我无法使用androidx存储库,所以我目前正在使用android支持库(v28.0.0-alpha1,alpha3不允许我使用材质按钮)
我正试图在文本旁边设置一个带有居中文字+图标的宽按钮:
但我能得到的就是这个带有按钮边缘图标的居中文字:
这与原始的android按钮相同,后者遇到了同样的问题.想法是材料按钮可以解决这个问题,但它似乎不适用于28.0.0-alpha1
有一些解决方案涉及使用复合抽屉制作文本视图并在其周围绘制框架,但如果可能的话,我想坚持使用材质按钮.
任何人都知道如何解决这个问题?
angular ×5
android ×3
c# ×1
dialog ×1
html ×1
javascript ×1
material-components-android ×1
material-ui ×1
reactjs ×1
typescript ×1