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

}

相关推荐
且随疾风前行.13 小时前
Android Binder 驱动 - 内核驱动层源码初探
android·网络·binder
额恩6613 小时前
AI 智能体从零搭建实战教程——扣子
android·rxjava·coze
hunterandroid13 小时前
前台服务适配与线上排查:通知权限、启动限制和任务保活
android·前端
帅次13 小时前
Android 高级工程师面试:Flutter 渲染与性能 近1年高频追问 20 题
android·flutter·面试·渲染·性能
糖果店的幽灵15 小时前
【langgraph 从入门到精通graphApi 篇】Command 与动态流程控制
android·java·数据库·人工智能·langgraph
Android-Flutter15 小时前
Android的http和https知识点
android·http·https
Kapaseker15 小时前
Sequence 一定比 List 快?等等,我们先从基础讲起
android·kotlin
AI刀刀16 小时前
deepseek 内容粘贴后符号丢失怎么办?AI 导出鸭实测解决排版乱码问题
android·人工智能·excel·ai导出鸭
东方佑16 小时前
Per-Group 混合精度量化:将 14B 视频生成模型压缩至 11 GB
android
三少爷的鞋16 小时前
Android 面试系列 : 协程为何比线程高效
android