How can I create a settings button in Android's app info page?

浪子不回头ぞ 提交于 2019-11-27 06:22:43

问题


Nova Launcher opens their settings with the cogwheel in the upper right. How is this done? How would I place my app's settings activity there?


回答1:


On Android 7.0 and higher, you can use this <intent-filter> on your settings activity:

<intent-filter>
  <action android:name="android.intent.action.APPLICATION_PREFERENCES" />
  <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

The Settings app should pick that up and make it available to the user via that gear icon.



来源:https://stackoverflow.com/questions/41105494/how-can-i-create-a-settings-button-in-androids-app-info-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!