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

}

相关推荐
胖虎118 分钟前
Android 文件下载实践:基于 OkHttp 的完整实现与思考
android·okhttp·下载文件·安卓下载·安卓中的下载
_李小白23 分钟前
【Android 美颜相机】第四天:CameraLoader、Camera1Loader 与 Camera2Loader
android·数码相机
00后程序员张26 分钟前
iOS APP 性能测试工具,监控CPU,实时日志输出
android·ios·小程序·https·uni-app·iphone·webview
YIN_尹34 分钟前
【MySQL】数据类型(下)
android·mysql·adb
invicinble42 分钟前
认识es的多个维度
android·大数据·elasticsearch
前端切图仔0011 小时前
Chrome 扩展程序上架指南
android·java·javascript·google
黄林晴1 小时前
Compose Multiplatform 1.10.0 重磅发布!三大核心升级,跨平台开发效率再提升
android·android jetpack
锁我喉是吧1 小时前
Android studio 编译faiss
android·android studio·faiss
鹏程十八少1 小时前
3. Android 腾讯开源的 Shadow,凭什么成为插件化“终极方案”?
android·前端·面试
TheNextByte11 小时前
如何通过蓝牙将联系人从Android传输到 iPhone
android·cocoa·iphone