Android initialExpandedChildrenCount高级菜单折叠项或铺展折叠项

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/system_dashboard_fragment.xml

<PreferenceScreen

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:settings="http://schemas.android.com/apk/res-auto"

android:key="system_dashboard_screen"

android:title="@string/header_category_system"

settings:initialExpandedChildrenCount="4">

意思是,超过4个菜单则折叠隐藏起来,否则没超过直接平铺展开显示!

@Override

public void onCreate(Bundle icicle) {

super.onCreate(icicle);

final PreferenceScreen screen = getPreferenceScreen();
// We do not want to display an advanced button if only one setting is hidden
if (getVisiblePreferenceCount(screen) == screen.getInitialExpandedChildrenCount() + 1) {
screen.setInitialExpandedChildrenCount(Integer.MAX_VALUE);
}

}

相关推荐
赏金术士8 小时前
Kotlin 习题集 · 高级篇
android·开发语言·kotlin
问心无愧051310 小时前
ctf show web 入门42
android·前端·android studio
没什么本事11 小时前
关于C# panel 添加lable问题 -- 明确X和Y 位置错误
android·java·c#
REDcker14 小时前
Android HWASan 详解:硬件标记原理、Clang 启用与排障实践
android·linux·debug·编译·clang·asan·hwasan
2501_9159090615 小时前
全面解析前端开发中常用的浏览器调试工具及其使用场景
android·ios·小程序·https·uni-app·iphone·webview
angerdream15 小时前
Android手把手编写儿童手机远程监控App之SQLite详解2
android
-SOLO-15 小时前
Python 爬取小红书 文章标题和内容 仅供学习
android·python·学习
ooseabiscuit16 小时前
Laravel5
android·php·laravel
科技道人16 小时前
Android 禁止使用ipv6 测试
android·禁用ipv6
AlexMaybeBot16 小时前
巧用 OpenClaw 为 Android 开发电脑瘦身
android·github·ai编程