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

}

相关推荐
Sirens.10 小时前
MySQL表设计进阶-约束范式连接索引与事务
android·数据库·mysql
zh_xuan13 小时前
安卓上 mmap读取并修改文件内容
android·mmap
二流小码农13 小时前
鸿蒙开发:实现文本渐变效果
android·ios·harmonyos
光头闪亮亮15 小时前
Fyne ( go跨平台GUI )项目实战-项目开发必备基础知识(中)
android·c++·go
光头闪亮亮15 小时前
Fyne ( go跨平台GUI )项目实战-项目开发必备基础知识(上)
android·sqlite·go
光头闪亮亮15 小时前
Fyne ( go跨平台GUI )项目实战-项目开发必备基础知识(下)
android·c++·go
Ch_champion15 小时前
2018年之前的Android 项目上使用的技术点(及第三方库)
android
龚礼鹏16 小时前
RK Android16 wifi 投屏失败问题排查
android
晓梦林18 小时前
[ACTF2020 新生赛]BackupFile学习笔记
android·笔记·学习
ITmaster073118 小时前
告别 IDE?Android CLI 来了,开发进入 AI Agent 时代
android·ide·人工智能