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

}

相关推荐
TA远方2 小时前
【Android】adb常用的命令用法详解
android·adb·管理·控制·命令
贺biubiu9 小时前
2025 年终总结|总有那么一个人,会让你千里奔赴...
android·程序员·年终总结
xuekai2008090110 小时前
mysql-组复制 -8.4.7 主从搭建
android·adb
nono牛11 小时前
ps -A|grep gate
android
未知名Android用户12 小时前
Android动态变化渐变背景
android
nono牛13 小时前
Gatekeeper 的精确定义
android
stevenzqzq14 小时前
android启动初始化和注入理解3
android
城东米粉儿16 小时前
compose 状态提升 笔记
android
粤M温同学16 小时前
Android 实现沉浸式状态栏
android
ljt272496066117 小时前
Compose笔记(六十八)--MutableStateFlow
android·笔记·android jetpack