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

}

相关推荐
stevenzqzq3 分钟前
快递盒模型
android
黄林晴22 分钟前
Composables CLI 发布!一站式创建与管理 Compose Multiplatform 项目
android
再让我睡两分钟28 分钟前
【无标题】
android·java·数据库·人工智能·prompt·ai应用开发
louisgeek12 小时前
Android Studio 和 Git
android
solo_9917 小时前
Android Event 日志完全指南
android
孙晓鹏life17 小时前
MySQL-Seconds_behind_master的精度误差
android·mysql·adb
雨白18 小时前
C 语言文件操作核心
android
鱼儿也有烦恼19 小时前
01.搭建Android Studio开发环境
android·android studio
m0_7381207220 小时前
PHP代码审计基础——面向对象(四)
android·开发语言·网络·安全·github·php
Coffeeee1 天前
搞Android的怎么可能搞不懂Context Engineering?
android·人工智能·ai编程