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

}

相关推荐
冬奇Lab7 分钟前
应用异常退出实战分析:一次"幽灵杀手"引发的车载系统故障排查
android·性能优化·debug
Ehtan_Zheng4 小时前
如何简化状态和实体映射Kotlin接口,委托和协变泛型
android
飘逸飘逸6 小时前
Autojs进阶前言
android·javascript
spencer_tseng6 小时前
Branding Printing System (Android Pad)
android·pad
FrameNotWork7 小时前
多设备 Android Logcat 自动采集方案:基于 Docker + Shell 实现日志按天切割与自动清理
android·docker·容器
bqliang8 小时前
Compose 实验性 Styles API
android·android jetpack
大尚来也8 小时前
PHP 入门指南:从零基础到掌握核心语法
android
summerkissyou19878 小时前
android -wifi/蓝牙-常见面试题
android·wifi·bluetooth
XiaoLeisj8 小时前
Android Activity 页面导航基础:Manifest 声明、Intent 显式/隐式跳转与数据传递
android·java