RingtonePreference中属性修改

来源:互联网 发布:大众老总途观 知乎 编辑:程序博客网 时间:2024/05/21 22:25

    <!-- Base attributes available to RingtonePreference. -->    <declare-styleable name="RingtonePreference">        <!-- Which ringtone type(s) to show in the picker. -->        <attr name="ringtoneType">            <!-- Ringtones. -->            <flag name="ringtone" value="1" />            <!-- Notification sounds. -->            <flag name="notification" value="2" />            <flag name="notification_2" value="16" />            <!-- Alarm sounds. -->            <flag name="alarm" value="4" />            <!-- All available ringtone sounds. 7 to 23-->            <flag name="all" value="23" />        </attr>        <!-- Whether to show an item for a default sound. -->        <attr name="showDefault" format="boolean" />        <!-- Whether to show an item for 'Silent'. -->        <attr name="showSilent" format="boolean" />    </declare-styleable>

在项目开发中需要对RingtonePreference进行修改,修改一个属性ringtoneType的值。因为RingtonePreference是继承自Preference类,同时它自己也有定义自己特定的属性值,比如ringtoneType,所以在ALPS.JB.MP.V1_DEV\frameworks\base\core\res\res\values\attr.xml里面定义如上所示。


其中的notification_2就是自己添加的属性。在这里面添加的ringtoneType就可以在程序中使用,来丰富ringtoneType的值。

在这个修改过程中还出现过一次提示某个静态值不对的错误。解决方式见本博转载的一篇文章,修改对应apiLevel的16.txt文档之后,成功编译通过。但是自己试过./mk c && ./mk update-api && ./mk n之后并没有解决,还是需要手动解决。看来是mtk的源码可能有些问题了。

原创粉丝点击