Nativescriptでhtmlのspan的な要素を使えるか調べてみたら見つかりました〜

とりあえず、サンプルコードはこちら
※アイキャッチ画像が実行後のイメージです


<Label class=“h3 p-15 m-15 text-left”>
    <FormattedString>
        <Span text=“Words ” color=“#006600”></Span>
        <Span text=“with ” color=“#990000” fontAttributes=“Bold”></Span>
        <Span text=“different ” color=“#ffcc00"></Span>
        <Span text=“color.“></Span>
    </FormattedString>
</Label>

ちなみにこちらのコードもサンプルで出ていましたけど、動きませんでした
コードはこちらの記事から見つけました

Bolding, Italicizing, and Underlining Portions of Text in NativeScript


<StackLayout class=“page m-20”>
  <Label>
    <FormattedString>
      <Span text=“NativeScript is an “></Span>
      <Span text=“AMAZING” fontAttributes=“Bold”></Span>
      <Span text=” framework.“></Span>
    </FormattedString>
  </Label>
</StackLayout>

参考にした記事

Bolding, Italicizing, and Underlining Portions of Text in NativeScript

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA