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·java·开发语言·前端·后端·uni-app·php
pigdreams14 小时前
Google 官方 Android CLI:让AI直接读布局结构而不是用adb截图验证
android·人工智能·adb
hunterandroid16 小时前
[Android 从零到一] Glide 图片加载原理:三级缓存、生命周期绑定与内存优化
android
法的空间17 小时前
AI 编程时代,为什么 Dart 分析会拖慢大型项目的开发
android·flutter·ios
鱼儿也有烦恼17 小时前
客户端应用架构模式
android·架构
独隅17 小时前
Claude 高效应用实战指南
android·java·开发语言·claude·claude code
硅基手札18 小时前
Android 系统全景专栏 00 · 总目录
android·操作系统·嵌入式开发
YB137518 小时前
Jetpack Compose 动画Crossfade
android
2401_8332693018 小时前
Android歌词功能实现
android
恋猫de小郭19 小时前
Flutter 紧急发布 3.47.8 安全升级版本,建议都升级
android·前端·flutter