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);
}

}

相关推荐
加农炮手Jinx15 分钟前
Flutter for OpenHarmony:pub_updater 命令行工具自动更新专家(DevOps 运维必备) 深度解析与鸿蒙适配指南
android·运维·网络·flutter·华为·harmonyos·devops
2601_957418801 小时前
告别OTG碎片化!Android MTP协议深度解析与高性能通信方案
android
故渊at1 小时前
第二板块:Android 四大组件标准化学理 | 第七篇:Activity 页面载体与任务栈算法
android·算法·生命周期·activity·任务栈
QING6182 小时前
Kotlin 协程新手指南 —— 协程上下文与调度器
android·kotlin·android jetpack
潘潘潘2 小时前
Android JAVA Socket 知识梳理
android
00后程序员张3 小时前
Jenkins 自动上传 IPA 到 App Store 把发布步骤融入 CI/CD
android·ios·小程序·https·uni-app·iphone·webview
Gary Studio3 小时前
复杂 SoC(RK3568)PCB 布局的五步
android·linux·硬件
plainGeekDev3 小时前
HttpURLConnection → OkHttp + Kotlin
android·java·kotlin
QING6183 小时前
Kotlin 协程新手指南 —— 协程基础与挂起函数
android·kotlin·android jetpack