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

}

相关推荐
事圆则缓32 分钟前
Java 常见数据结构与 Android 使用场景
android·java·数据结构
RisunJan1 小时前
Android 高频面试题与解答
android
MyBili1 小时前
【安卓开发/搞机】快图浏览(QuickPic)技术解析:为何这款3MB应用仍是本地图库的性能天花板?
android·app·安卓·文件管理·相册·看图软件·手机相册
事圆则缓1 小时前
Kotlin 高阶工程化与 Android 深入实践
android·开发语言·kotlin
zhangphil1 小时前
AI大模型生成maxTokens 与上下文context
android·llama
淡淡的香烟2 小时前
Androidiot开发之猫脸识别
android·物联网
2501_915106322 小时前
iOS数据采集技术详解:从性能监控到崩溃分析的全链路实践
android·ios·小程序·https·uni-app·iphone·webview
天空之城--11 小时前
Android Koin 完全指南:从原理到实践
android
zhangphil12 小时前
Android main thread主线程Choreographer doFrame发生FullSuspendCheck
android
TimeFine15 小时前
智能眼镜开发:获取真实的音频路由
android