Settings-快捷方式BUG

一:搜索英文状态的Settings快捷方式:<string name="settings_shortcut">Settings shortcut</string>

搜索settings_shortcut-->找到manifest中的启动界面<activity android:name="CreateShortcut" android:label="@string/settings_shortcut"结果计入之后这个activity是个列表activity结果码的activity它之前肯定有个activity跳转过来,显然走不通后得知,桌面小插件的程序是这个SettingsAppWidgetProvider

二:今天先说附加功能这个界面accessibility_settings这个类。

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
        android:title="@string/accessibility_settings_title">


    <PreferenceCategory
            android:key="services_category"
            android:title="@string/accessibility_services_title">
    </PreferenceCategory>


    <PreferenceCategory
            android:key="system_category"
            android:title="@string/accessibility_system_title">


        <PreferenceScreen
            android:fragment="com.android.settings.accessibility.ToggleCaptioningPreferenceFragment"---------------------------------------------------------------切换字幕
            android:key="captioning_preference_screen"
            android:title="@string/accessibility_captioning_title" />


        <PreferenceScreen
            android:fragment="com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment"-------------------------------------------------屏幕放大(没有)
            android:key="screen_magnification_preference_screen"
            android:title="@string/accessibility_screen_magnification_title"/>


        <CheckBoxPreference
                android:key="toggle_large_text_preference"
                android:title="@string/accessibility_toggle_large_text_preference_title"------------------------------------------------------------------------------------------大号字体选择框
                android:persistent="false"/>


        <CheckBoxPreference
                android:key="toggle_power_button_ends_call_preference"----------------------------------------------------------------------------------------------------------按电源按钮结束通话
                android:title="@string/accessibility_power_button_ends_call_prerefence_title"
                android:persistent="false"/>


        <CheckBoxPreference
                android:key="toggle_lock_screen_rotation_preference"---------------------------------------------------------------------------------------------------------------锁定屏幕旋转(没有
                android:title="@string/accelerometer_title"
                android:persistent="false"/>


        <CheckBoxPreference
                android:key="toggle_speak_password_preference"----------------------------------------------------------------------------------------------------------------------说密码(没有)
                android:title="@string/accessibility_toggle_speak_password_preference_title"
                android:persistent="false"/>


        <PreferenceScreen
                android:fragment="com.android.settings.accessibility.ToggleGlobalGesturePreferenceFragment"-------------------------------------------------------全球姿态切换(没有)
                android:key="enable_global_gesture_preference_screen"
                android:title="@string/accessibility_global_gesture_preference_title"/>


        <PreferenceScreen android:key="tts_settings_preference"-------------------------------------------------------------------------------------------------------------------文字转语音的TTS
                android:fragment="com.android.settings.tts.TextToSpeechSettings"
                android:title="@string/tts_settings_title"/>


        <ListPreference android:key="select_long_press_timeout_preference"---------------------------------------------------------------------------------------------------选择长按超时
                android:title="@string/accessibility_long_press_timeout_preference_title"
                android:entries="@array/long_press_timeout_selector_titles"
                android:entryValues="@array/long_press_timeout_selector_values"
                android:persistent="false"/>


    </PreferenceCategory>


</PreferenceScreen>


-----------------

onCreate()方法中

addPreferencesFromResource(R.xml.accessibility_settings);加载布局

initializeAllPreferences()执行实例化上面xml的控件


--------------------

onResume()方法


-----------------------

分析captions字幕这个界面-->  android:fragment="com.android.settings.accessibility.ToggleCaptioningPreferenceFragment切换字幕
            android:key="captioning_preference_screen"可以推出是下面这个类

ToggleCaptioningPreferenceFragment这个类

xml文件是

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/captioning_preview_height" >


        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:contentDescription="@null"
            android:scaleType="centerCrop"
            android:src="@drawable/caption_background" />


        <com.android.internal.widget.SubtitleView
            android:id="@+id/preview_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|start"
            android:layout_margin="16dp"
            android:text="@string/captioning_preview_text" />
    </FrameLayout>
------------------------------------------------------------------------------------------------------------------图片显示在上面

    <fragment
        android:id="@+id/properties_fragment"
        android:name="com.android.settings.accessibility.CaptionPropertiesFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
---------------------------------------------------------------------------------------------------------------------是个fragment

</LinearLayout>

这个类里面就是实例化控件,设置显示字体,设置actionbar开关控件

----------------------------------------------------------------------------------------------------------------------------------------------------

继续分析

CaptionPropertiesFragment-------------------------------这个名字就是下面对应的那个fragment

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
    android:fragment="com.android.settings.accessibility.ToggleCaptioningPreferenceFragment"
    android:key="captioning_preference_screen"
    android:title="@string/accessibility_captioning_title" >


    <PreferenceCategory
        android:key="standard"
        android:title="@string/captioning_standard_options_title" >-----------------------------------------categry就是那个界面的fragment的第一个小标题
        <com.android.settings.accessibility.LocalePreference---------------------------------------设置语言
            android:key="captioning_locale"
            android:persistent="false"
            android:summary="%s"
            android:title="@string/captioning_locale" />


        <ListPreference
            android:entries="@array/captioning_font_size_selector_titles"--------------------------------设置字体
            android:entryValues="@array/captioning_font_size_selector_values"
            android:key="captioning_font_size"
            android:persistent="false"
            android:summary="%s"
            android:title="@string/captioning_text_size" />


        <com.android.settings.accessibility.PresetPreference------------------------------------------------是那个captiong  Style
            android:key="captioning_preset"
            android:persistent="false"
            android:title="@string/captioning_preset" />
    </PreferenceCategory>
    <PreferenceCategory
        android:key="custom"
        android:title="@string/captioning_custom_options_title" >
        <ListPreference
            android:entries="@array/captioning_typeface_selector_titles"
            android:entryValues="@array/captioning_typeface_selector_values"
            android:key="captioning_typeface"
            android:persistent="false"
            android:summary="%s"
            android:title="@string/captioning_typeface" />


        <com.android.settings.accessibility.ColorPreference
            android:key="captioning_foreground_color"
            android:persistent="false"
            android:title="@string/captioning_foreground_color" />


        <com.android.settings.accessibility.EdgeTypePreference
            android:key="captioning_edge_type"
            android:persistent="false"
            android:title="@string/captioning_edge_type" />


        <com.android.settings.accessibility.ColorPreference
            android:dependency="captioning_edge_type"
            android:key="captioning_edge_color"
            android:persistent="false"
            android:title="@string/captioning_edge_color" />
        <com.android.settings.accessibility.ColorPreference
            android:key="captioning_background_color"
            android:persistent="false"
            android:title="@string/captioning_background_color" />
        <com.android.settings.accessibility.ColorPreference
            android:dependency="captioning_background_color"
            android:key="captioning_background_opacity"
            android:persistent="false"
            android:title="@string/captioning_background_opacity" />
    </PreferenceCategory>


</PreferenceScreen>

-------------------------------------

oncreate中

加载上面的那个布局,






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值