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

}

相关推荐
又见情义2 分钟前
RK3568 Android 13 SDK 开机自动开启共享热点实践
android
mmsx1 小时前
return false 不是拦截:一次按键触发两个动作的事件冒泡陷阱
android·bug
DU_YULIN1 小时前
Camera HAL ThreadManager概述
android·camera hal
淡淡的香烟2 小时前
Android中的MQTT通信原理解析
android·物联网
淡淡的香烟2 小时前
Android Camera开发详解
android·音视频
mmsx3 小时前
基于 Android 的校园信息管理系统源码
android·java·okhttp
YF02114 小时前
如何进入Android工程模式
android
Kevin Coding5 小时前
JsonConvert:适用于 Android、鸿蒙与 Flutter 的 JSON 转 Model 插件
android·flutter·harmonyos
xcLeigh7 小时前
Go入门:基本数据类型全览与选择指南
android·服务器·golang·教程·go热门
alexhilton7 小时前
规范驱动开发:让AI生成符合预期的KMP代码
android·kotlin·android jetpack