--> -->

skimemo


skimemo - 日記/2019-05-13/NativeScriptでActionItemの色を指定する

_ NativeScriptでActionItemの色を指定する

NativeScriptでActionBarの右端にメニューを出す場合、マニュアル通り以下のようにします。

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
<ActionBar class="action-bar">
    <Label class="action-bar-title" text="受信箱"></Label>
    <ActionItem tap="onInbox"
        text="受信箱" android.position="popup"
        visibility="{{ isInbox ? 'collapse' : 'visible' }}">
        </ActionItem>
    <ActionItem tap="onSendbox"
        text="送信箱" android.position="popup"
        visibility="{{ isSendbox ? 'collapse' : 'visible' }}">
        </ActionItem>
    <ActionItem tap="onTrash"
        text="ごみ箱" android.position="popup"
        visibility="{{ isTrash ? 'collapse' : 'visible' }}">
        </ActionItem>
</ActionBar> 

デフォルトだと以下のように表示されますが、色がグレーです。

Screenshot_2019-05-13-09-39-42.png


この色を変えるにはclassで指定してもダメで、resourceを追記する必要があります。
詳しくはこちら
ファイルはApp_Resources\Android\src\main\res\values\styles.xml
追記するのはname="AppThemeBase"の中です。

  1
  2
  3
  4
  5
  6
<!-- theme to use AFTER launch screen is loaded-->
<style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
                           :
                           :
    <item name="android:textColorSecondary">#fff</item>
</style> 
Screenshot_2019-05-13-09-58-59.png

;-)

Category: [NativeScript] - 10:09:39



 
Last-modified: 2019-05-13 (月) 10:23:15 (1802d)