material-design 相关问题

材料设计是Google针对Android 5.0 Lollipop引入的跨平台和设备的视觉,动作和交互设计指南。

mat-slide-toggle 的 MatSlideToggleChange 事件的使用

我正在尝试使用表单中的开关来切换同一表单中两个下拉菜单之一的外观。 我可以使用 MatSlide 类切换发出的 MatSlideToggleChange 事件来实现我的

回答 3 投票 0

如何在 Flutter 中为禁用的文本表单字段的标签设置主题颜色?

我想在我的 Flutter 应用程序中的禁用文本字段标签上应用一个主题,因为我现在的灰色很难阅读。 我想将它应用到我的整个应用程序,所以我想使用

回答 4 投票 0

有没有办法禁用Material UI扩展面板的动画?

我想禁用React中Material UI扩展面板的动画。 如何禁用应用于扩展面板的所有动画? 尝试覆盖转换但没有帮助。 ...

回答 5 投票 0

MUI:抽屉保持打开状态的概率约为五分之一?

我有一个 MUI 抽屉,应该在单击菜单项后关闭,但大约五分之一的时间它保持打开状态。我已经根据这篇文章对我当前的代码进行了建模。 这是代码: 导航栏

回答 2 投票 0

CSS className 的特异性低于material-ui v5 中的 css 类

当在我的react应用程序中使用@material-ui/core中的IconButton时,我应用了一个类名classes.myCloseButtonstyle,事实证明与css类.css-1743419-

回答 4 投票 0

如何在 React 中禁用 Material UI 日期选择器的下划线?

如何禁用向material-ui-pickers显示下划线? 沙箱 https://codesandbox.io/s/l2ykr7kwvz?from-embed 我想删除其文本字段的下划线。 我试过 禁用下划线={tr...

回答 2 投票 0

使谷歌的SignInButton带有圆角,看起来像一个材质按钮

TLDR:我想让 Google 的登录按钮看起来像一个圆角形状的材质按钮,并保留其余部分(文本,默认情况下谷歌图标)。 我已经使用 Firebase 实现了登录功能...

回答 1 投票 0

Material Design - Bootstrap 输入字段问题

这是我得到的MDB引导代码。 代码链接:https://mdbootstrap.com/docs/standard/extended/login/#:~:text=EDIT%20IN%20SANDBOX-,Registration%20page,-Once%20again%2C%20the

回答 0 投票 0

材质对话框 - 如何更改单选项目中复选框的颜色?

我正在尝试更改材质对话框的单选按钮的颜色,我在此处和此处的文档中发现的可能性是使用 app:singleChoiceItemLayout 覆盖整个布局,但是...

回答 1 投票 0

Material Design 3 with Angular

我是 Material Design 的新手,我正在研究是否可以将 Material Design 3 与 Angular 版本 17 一起使用。 我已按照 Material Design 3 中提到的步骤并成功安装,但我

回答 1 投票 0

如何根据appbar自动给Android的状态栏着色

根据应用栏的材质3规格,不仅应用栏本身,状态栏也应该在滚动应用栏下的列表时调整其颜色。如何实现这一目标?我们是否应该...

回答 1 投票 0

更改 Material 3 开关的轮廓颜色

我正在尝试找到一种方法来更改材质 3 开关的轮廓颜色,由于某些奇怪的原因我找不到方法,如果有人能告诉我如何在 XM 中做到这一点,我将不胜感激。 .

回答 1 投票 0

两个具有相同标高的相邻可组合项呈现出分隔阴影

我想在粘性顶部栏下方呈现一个可折叠栏。在可折叠杆完全展开的初始状态下,我希望两个杆看起来位于完全相同的高度...

回答 1 投票 0

角度垫选择文本颜色不会改变

我在我的 Angular 应用程序中使用 mat-select。我想改变文字颜色,但颜色没有改变。 我在 Angular 应用程序中使用 mat-select。我想改变文字颜色,但颜色没有改变。 <mat-select style="color: red" [(ngModel)]="someValue"> <mat-option>class="empty-select"</mat-option> <mat-option class="not-empty-select" *ngFor="let unit of units [value]="unit">{{unit}}</mat-option> </mat-select> 我可以毫无问题地更改背景颜色,但文本颜色不会更改。 您需要在 mat-option 而不是 mat-select 上应用样式,如下所示: <mat-select [(ngModel)]="someValue"> <mat-option class="empty-select"></mat-option> <mat-option style="color: red" class="not-empty-select" *ngFor="let unit of units [value]="unit">{{unit}}</mat-option> </mat-select> 您还可以在课堂上设置颜色not-empty-select。 更新1: 如果您想更改所选选项的颜色,请添加以下 CSS: .not-empty-select.mat-selected { color: green !important; } 更新2: 如果您想更改选择框中的颜色,请将 CSS 修改为: .not-empty-select.mat-selected { color: green !important; } :host /deep/ .mat-select-value-text { color: green !important; } 如果仔细检查 mat-select-value 是在 mat-select 标签中保存占位符字体的 css 的类; 所以使用 ::ng-deep .mat-select-value{ color: white!important; } 将应用您指定的颜色。 !重要的是覆盖默认值。 您可以将以下元素的 css 覆盖为 - 选择框面板 /deep/ .mat-select-panel { background-color: red; } 选择框选项元素 /deep/ .mat-form-field-infix{ background-color: red; } 选择框 /deep/ .mat-select{ background-color: red; } 不要忘记添加/deep/,如上所述。 选择框文本颜色 如果您想更改选择的文本颜色,请使用此选项。 /deep/ .mat-form-field-type-mat-select .mat-form-field-label, .mat-select-value { color: red; } 演示副本在这里 - https://stackblitz.com/edit/angular-material-pagination-123456-5teixy 将其添加到您的 styles.css 文件中 .mat-select-red .mat-select-value{ color: red !important; } 在你的 component.html 文件中 <mat-select class="mat-select-red" [(ngModel)]="someValue"> <mat-option>class="empty-select"</mat-option> <mat-option class="not-empty-select" *ngFor="let unit of units [value]="unit">{{unit}}</mat-option> </mat-select> ::ng-deep .mat-select-arrow { display: none !important; } 它对我有用 <mat-select [(ngModel)]="someValue"> <mat-option style="color: red" >class="empty-select"</mat-option> <mat-option style="color: red" class="not-empty-select" *ngFor="let unit of units [value]="unit">{{unit}}</mat-option> </mat-select> option appearance (legacy, standard, fill, outline) <mat-form-field appearance="legacy"> <mat-label>Choose an option</mat-label> <mat-select> <mat-option value="option1">Option 1</mat-option>... </mat-select> </mat-form-field> 假设您有此选择: <mat-form-field appearance="fill"> <mat-label>The label</mat-label> <mat-select> <mat-option value="This">This</mat-option> <mat-option value="That">That</mat-option> </mat-select> </mat-form-field> 显示如下: 要仅设置颜色样式,请尝试以下操作: ::ng-deep .mat-form-field.mat-focused .mat-form-field-ripple { background-color: red; } ::ng-deep .mat-form-field.mat-focused .mat-form-field-label { color: red; } ::ng-deep .mat-form-field.mat-focused.mat-primary .mat-select-arrow{ color: red; } ::ng-deep .mat-primary .mat-option.mat-selected:not(.mat-option-disabled){ color: red; } 产生 这适用于 Angular 11.2.0、Angular Material 11.2.0。 这帮助我更改了所选文本的样式: ::ng-deep .mat-selected .mat-option-text { color: white!important; } 如果您需要从变量设置 mat-option 的颜色,您应该: 在mat-select中设置panelClass: panelClass="继承颜色"> 设置CSS规则: .inherit-color .mat-option { 颜色:继承!重要; } 将 mat-option 包裹在 span 中并在其中设置样式: {{一些}}

回答 10 投票 0

Angular 6 Material <mat-select>使用表单控件设置多个默认值

我正在使用表单控件,这是我的 html 组件的代码 我正在使用表单控件,这里是我的 html 组件的代码 <mat-form-field> <mat-select placeholder="Toppings" [formControl]="toppings" multiple> <mat-option *ngFor="let topping of toppingList" [value]="topping">{{topping.value}}</mat-option> </mat-select> </mat-form-field> 我的 ts 文件是 export class SelectMultipleExample { toppings = new FormControl(); toppingList: any[] = [ { id:1,value:"test 1"}, { id:2,value:"test 2"}, { id:3,value:"test 4"}, { id:4,value:"test 5"}, { id:5,value:"test 6"}, { id:6,value:"test 7"} ]; constructor(){ this.bindData(); } bindData(){ const anotherList:any[]=[ { id:1,value:"test 1"}, { id:2,value:"test 2"} ] this.toppings.setValue(anotherList) } } 我想为 mat select 设置默认值,任何帮助如何实现这一点都会很棒。我想设置多个默认值。 问题是由于你的选项是对象。为了应用选择,所选对象必须与选项中使用的对象相同。按如下方式修改您的代码: export class SelectMultipleExample { toppings = new FormControl(); toppingList: any[] = [ { id:1,value:"test 1"}, { id:2,value:"test 2"}, { id:3,value:"test 4"}, { id:4,value:"test 5"}, { id:5,value:"test 6"}, { id:6,value:"test 7"} ]; constructor(){ this.bindData(); } bindData() { const anotherList: any[] = [ this.toppingList[0], this.toppingList[1] ] this.toppings.setValue(anotherList) } } <mat-form-field> <mat-label>Select Global Markets</mat-label> <mat-select [formControl]="globalmarketCategory" multiple > <mat-option *ngFor="let list of toppingList" [value]="list">{{list.value}}</mat-option> </mat-select> export class SelectMultipleExample { globalmarketCategory= new FormControl(); toppingList: any[] = [ { id:1,value:"test 1"}, { id:2,value:"test 2"}, { id:3,value:"test 4"}, { id:4,value:"test 5"}, { id:5,value:"test 6"}, { id:6,value:"test 7"} ]; list = [] constructor(){ const anotherList:any[]=[ { id:1,value:"test 1"}, { id:2,value:"test 2"} ] this.globalmarketCategory.setValue(anotherList); } } 您可以使用 compareWith 的 mat-select 属性。查看答案https://stackoverflow.com/a/57169425/1191125 使用多个时使用compareWith函数。 所以 HTML 看起来像这样 <mat-form-field> <mat-select [compareWith]="compareFn" [(ngModel)]="theArrayofSelectedValues"> <mat-option *ngFor="let obj of listOfObjs" [value]="obj"> {{ obj.name }} </mat-option> </mat-select> </mat-form-field> 在 TS 中比较Fn compareFn(o1: any, o2: any) { if(o1.id == o2.id ) return true; } G给出的答案。 Tranter 给出了正确答案。 根据他们的回答,我创建了以下更详细的示例(可能更接近此功能的实际实现): toppings.html: <mat-form-field> <mat-label>Select Your Favorite Topping(s)</mat-label> <mat-select placeholder="Select Topping(s)" [formControl]="ToppingsControl" required multiple> <mat-option *ngFor="let t of AllToppings" [value]="t">{{t.Name}}</mat-option> </mat-select> </mat-form-field> toppings.ts: import { Component } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import ITopping from 'src/app/interfaces/topping-dto'; @Component({ selector: 'toppings', templateUrl: './toppings.html', styleUrls: ['./toppings.css'] }) export default class SelectMultipleExample { protected ToppingsControl: FormControl<Array<ITopping>> = new FormControl(null, Validators.required); protected AllToppings: Array<ITopping> = []; public constructor() { // These values can be injected, pulled from a database, etc. this.AllToppings.push({ Id: 1, Name: 'Sprinkles' }); this.AllToppings.push({ Id: 2, Name: 'Hot Fudge' }); this.AllToppings.push({ Id: 3, Name: 'Whipped Cream' }); this.AllToppings.push({ Id: 4, Name: 'Crushed Nuts' }); this.AllToppings.push({ Id: 5, Name: 'Maraschino cherries' }); // Get a reference to the objects that are initially selected by default let selectedToppings: Array<ITopping> = [ this.AllToppings[0], this.AllToppings[1] ]; // Set the value of the control to be the selected objects this.ToppingsControl.setValue(selectedToppings); } } topping-dto.ts: interface ITopping { Id: number, Name: string } export default IClientDto;

回答 5 投票 0

如何正确从Material Design TextInputLayout获取文本?

我想使用自定义结束图标从材料设计的 TextInputLayout 中获取文本。 我尝试这样做: TextInputLayout textInputCustomEndIcon = findViewById(R.id.editText); 最终的 TextInputEdi...

回答 6 投票 0

材质 3 colorSchemeSeed 并具有纯黑白主题

使用 Material 3,colorSchemeSeed 可用于设置整个应用程序的颜色。这适用于红色、蓝色和绿色等颜色。如果保留默认值,颜色将为紫色。当尝试使用 bl...

回答 3 投票 0

更改 TextInputEditText 提示样式

我想更改 TextInputEditText 类型 FilledBox 当输入提示需要粗体样式和颜色#FF0000(红色)之前 当输入提示样式常规和颜色#000000(黑色)后 我该怎么办

回答 1 投票 0

java.lang.NoSuchFieldError:类中没有类型 I 的字段 $stable

尝试导航到使用材质运动的片段时出现以下错误。 使用的版本: 科特林 1.5.10 撰写 Beta 09 材质1.4.0-rc01 片段1.3.5 AGP 7.0.0-beta03(有...

回答 5 投票 0

特定色调的材料设计 3 (MD3) 颜色代码

Material Theme Builder 可以生成 MD3 调色板,但它不提供表面容器的颜色代码(例如 N-96、N-94、N-92 等),我可以在其中找到以下颜色代码他们?

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.