Suche…


Hinzufügen eines Musterlayouts in Ihrer App

Hauptkomponente.ts

import {Component} from "@angular/core";

@Component({
    selector: "main",
    template: `
    <StackLayout>
      <TextField hint="some text"></TextField>
      <Button text="Click me" class="btn"></Button>
    </StackLayout>
    `,
    styleUrls: ["pages/main/main-common.css", "pages/main/main.css"]
})
export class MainComponent { }

Methode 1: Globales CSS

app.css - Gilt global für alle Layouts.

StackLayout {
  margin: 10;
  background-color: white;
}
.btn, TextField {
  margin-left: 16;
  margin-right: 16;
}

Methode 2: Plattformspezifisches CSS

platform.android.css - Gilt global für alle Layouts im Android-Gerät.

.btn{
    background-color: #191919;
    color: #fff;
}

platform.ios.css - Gilt global für alle Layouts in iOS-Geräten.

.btn{
    background-color: #fff;
    color: #191919;
}

app.css

@import url("~/platform.css");

Methode 3: Komponentenspezifisches CSS

pages / main / main.android.css - Gilt für bestimmte Komponenten in Android-Geräten.

TextField {
  color: #e1e1e1;
  font-size: 12;
}

pages / main / main.ios.css - Gilt für bestimmte Komponenten in iOS-Geräten.

TextField {
  color: #e3e3e3;
  font-size: 15;
}

pages / main / main-common.css - Gilt für bestimmte Komponenten in allen Geräten.

TextField {
  padding: 4;
}


Modified text is an extract of the original Stack Overflow Documentation
Lizenziert unter CC BY-SA 3.0
Nicht angeschlossen an Stack Overflow