1. 程式人生 > >Android 7.0 如何將應用新增設定列表

Android 7.0 如何將應用新增設定列表

android 7.0

通過AndroidManifest.xml對activity處理,將應用選單新增到settings列表中

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="wangjicong.toolsbar">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity"
            android:label="@string/app_name"
            android:icon="@mipmap/ic_launcher"
            android:configChanges="keyboardHidden|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter android:priority="4">
                <action android:name="com.android.settings.action.SETTINGS" />
            </intent-filter>
            <meta-data android:name="com.android.settings.category"
                android:value="com.android.settings.category.system" />
            <meta-data android:name="com.android.settings.icon"
                android:resource="@drawable/ic_settings_breathinglight" />
            <meta-data android:name="com.android.settings.title"
                android:resource="@string/app_name" />
        </activity>
    </application>

</manifest>

當然有些系統廠商是不允許第三方應用新增到settings中的