Settings-快捷方式BUG

本文详细解析了安卓系统的辅助功能设置界面,包括字幕切换、屏幕放大等功能的实现方式及对应的XML配置。深入探讨了CaptionPropertiesFragment等组件的布局与交互。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一:搜索英文状态的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中

加载上面的那个布局,






### 如何在 Ubuntu 系统上为 Vivado 创建桌面快捷方式 #### 方法一:通过创建 `.desktop` 文件实现桌面快捷方式 为了使 Vivado 可以通过点击桌面图标启动,在桌面上创建一个`.desktop`文件是一个有效的方法。具体操作如下: 编写一个新的文本文件并保存为 `Vivado.desktop`,其内容应包含必要的路径和描述信息[^2]。 ```bash [Desktop Entry] Version=1.0 Name=Vivado Comment=Launch Vivado IDE Exec=/path/to/vivado-launch-script %f Icon=/path/to/icon.png Terminal=false Type=Application Categories=Development; ``` 注意替换 `/path/to/vivado-launch-script` 和 `/path/to/icon.png` 为实际的 Vivado 启动脚本位置以及想要使用的图标的绝对路径。 完成编辑后,将此文件放置于用户的桌面目录下,并赋予可执行权限以便能够正常启动程序。 ```bash chmod +x ~/Desktop/Vivado.desktop ``` #### 方法二:利用现有应用程序菜单中的条目 如果已经成功安装了 Vivado 并能在Ubuntu的应用列表里找到它,则可以直接从这里拖拽至桌面形成快捷方式[^3]。这种方式更加简便快速,适合那些不熟悉手动配置文件的用户。 对于某些版本的Ubuntu来说,可能还需要额外设置环境变量来确保Vivado能顺利加载所需库文件。这通常涉及到修改个人shell配置文件(如`.bashrc`),加入类似下面这样的行以指向正确的Xilinx工具链路径[^1]。 ```bash source /opt/Xilinx/Vivado/20XX.X/settings64.sh ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值