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

}

相关推荐
赏金术士6 小时前
Kotlin 数据流与单双向绑定
android·开发语言·kotlin
小白学鸿蒙7 小时前
Unity 3D 2023解压安装,配置安卓运行环境后打包安卓应用(踩坑无数之差点放弃)
android·unity·游戏引擎
阿巴斯甜8 小时前
2026小知识点(9)
android
古月-一个C++方向的小白9 小时前
MySQL数据库——数据类型
android·数据库·mysql
张小潇11 小时前
AOSP15 WMS/AMS系统开发 - WindowManagerService finishDraw与prepareSurface流程详解
android
帅次13 小时前
Modifier 链与顺序、测量与命中区域
android·kotlin·compose·modifier
leory14 小时前
请详细描述Handler消息机制的工作原理
android·面试
leory14 小时前
请描述Binder IPC的基本原理和工作流程
android·面试
leory14 小时前
View的事件分发机制是怎样的?dispatchTouchEvent、onInterceptTouchEvent、onTouchEvent的关系?
android·面试
zander25814 小时前
Canal本地部署保姆级教程
android