Android Resources converting to string TypedValue warning

后端 未结 6 1009
旧巷少年郎
旧巷少年郎 2020-12-13 23:12

Ok I\'m looking right past something here..

Every time I\'m in my app and I change activities, logcat reports series of warnings:

02-04 14:42:36.524:         


        
6条回答
  •  不知归路
    2020-12-13 23:59

    I've discovered that this warning is also outputted when specifying a plurals string from a widget that requires parameters.

    For instance:

    
        %d song in playlist
        %d songs in playlist
    
    

    The warning will appear when inflating an activity that contains a widget referencing it:

    
    

    You no doubt replace the string after inflating the views to set the correct parameters, e.g.:

    playlistSongCount.setText(
            getResources().getQuantityString(
                R.plurals.song_count,
                songCount,
                songCount));
    

    The obvious solution here is to remove the android:text attribute from the layout as it has no purpose.

提交回复
热议问题