<string-array name="config_statusBarIcons"> <item><xliff:g id="id">managed_profile</xliff:g></item> <item><xliff:g id="id">ime</xliff:g></item> <item><xliff:g id="id">sync_failing</xliff:g></item> <item><xliff:g id="id">sync_active</xliff:g></item> <item><xliff:g id="id">cast</xliff:g></item> <item><xliff:g id="id">hotspot</xliff:g></item> <item><xliff:g id="id">location</xliff:g></item> <item><xliff:g id="id">bluetooth</xliff:g></item> <item><xliff:g id="id">nfc</xliff:g></item> <item><xliff:g id="id">headset</xliff:g></item> <! -- 这是本人增加的 --> <item><xliff:g id="id">tty</xliff:g></item> <item><xliff:g id="id">speakerphone</xliff:g></item> <item><xliff:g id="id">zen</xliff:g></item> <item><xliff:g id="id">mute</xliff:g></item> <item><xliff:g id="id">volume</xliff:g></item> <item><xliff:g id="id">wifi</xliff:g></item> <item><xliff:g id="id">cdma_eri</xliff:g></item> <item><xliff:g id="id">data_connection</xliff:g></item> <item><xliff:g id="id">phone_evdo_signal</xliff:g></item> <item><xliff:g id="id">phone_signal</xliff:g></item> <item><xliff:g id="id">battery</xliff:g></item> <item><xliff:g id="id">alarm_clock</xliff:g></item> <item><xliff:g id="id">secure</xliff:g></item> <item><xliff:g id="id">clock</xliff:g></item> </string-array>
然后在代码里获取该id对应的数组
String[] str = res.getStringArray(com.android.internal.R.array.config_statusBarIcons_added); for (int i = 0; i < str.length; i++) { Slog.i(TAG,"getStringArray " + i + " : "+ str[i]); }
打印的log如下
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 0 : managed_profile
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 1 : ime
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 2 : sync_failing
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 3 : sync_active
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 4 : cast
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 5 : hotspot
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 6 : location
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 7 : bluetooth
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 8 : nfc
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 9 : femtoicon
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 10 : tty
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 11 : speakerphone
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 12 : zen
01-01 13:01:20.781 I/StatusBarManagerService( 1234): getStringArray 13 : mute
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 14 : volume
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 15 : wifi
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 16 : vowifi
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 17 : cdma_eri
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 18 : data_connection
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 19 : phone_evdo_signal
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 20 : phone_signal
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 21 : battery
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 22 : alarm_clock
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 23 : secure
01-01 13:01:20.782 I/StatusBarManagerService( 1234): getStringArray 24 : clock
没有增加的headset,res跟systemimage都编译了,一直没效果,求指导答。
50
50