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

}

相关推荐
程序员正茂10 分钟前
Android studio中初步使用OpenCV库
android·opencv
紫_龙35 分钟前
window 维护多版本Android studio
android·ide·android studio
杉氧2 小时前
KMP 自动化之路 (4):iOS 自动化构建与签名 —— 攻克最硬的骨头
android·架构·android jetpack
通玄6 小时前
Jetpack Compose 入门系列(十):Paging 3 分页加载
android
hunterandroid6 小时前
DataStore 工程化实践:迁移、并发更新与异常恢复
android·前端
程序员-珍8 小时前
报错下载android sdk失败
android·java
齊家治國平天下10 小时前
AAOS 电源管理深度解析:休眠/唤醒/功耗优化
android·车载系统·aaos·aosp·电源管理·休眠唤醒·carpowermanager
qq36219670510 小时前
安卓大版本升级后APK不兼容怎么办?2026跨版本更新指南
android
Xzaveir10 小时前
企业号码展示不可观测怎么办:状态机、拨测事件与异常回放
android·人工智能
2501_9160074710 小时前
iOS和macOS应用程序性能分析和优化工具使用综合指南
android·macos·ios·小程序·uni-app·iphone·webview