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

}

相关推荐
李少兄34 分钟前
MySQL分页重复问题深度剖析
android·数据库·mysql
_李小白2 小时前
【android opencv学习笔记】Day 24: 最大稳定极值区域
android·opencv·学习
问心无愧05133 小时前
ctf show web入门257
android·前端·笔记
张小潇3 小时前
AOSP15 WMS/AMS系统开发 - 远程动画 (ShellAnimation) 源码深度分析
android
朱涛的自习室4 小时前
30天11万行代码,我用 Trae 和 Gemini 造了个 AI 测试引擎
android·前端·人工智能
Digitally4 小时前
如何删除三星 Galaxy 手机中的重复音乐?
android
ch_ziyuan4 小时前
2026新优化神马TV8.5影视点播系统保姆级搭建教程:三后台配置+反编译修改
android·ios·php
帅次4 小时前
Jetpack Compose 动画实战:animateFloatAsState、AnimatedVisibility 与 graphicsLayer 避坑
android·kotlin·gradle·android jetpack
问心无愧05135 小时前
ctf show web 入门258
android·前端·笔记
AI玫瑰助手5 小时前
Python函数:def定义函数与参数传递基础
android·开发语言·python