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

}

相关推荐
红橙Darren11 分钟前
手写操作系统 - 环境搭建
android·微信·操作系统
_一条咸鱼_15 分钟前
Android Runtime直接内存管理原理深度剖析(73)
android·面试·android jetpack
你听得到1116 分钟前
揭秘Flutter图片编辑器核心技术:从状态驱动架构到高保真图像处理
android·前端·flutter
wilinz17 分钟前
Flutter Android 端接入百度地图踩坑记录
android·flutter
小袁拒绝摆烂3 小时前
SQL开窗函数
android·sql·性能优化
apihz4 小时前
VM虚拟机全版本网盘+免费本地网络穿透端口映射实时同步动态家庭IP教程
android·服务器·开发语言·网络·数据库·网络协议·tcp/ip
baidu_247438614 小时前
Android MPAndroidChart使用
android
天平5 小时前
react native现代化组件库的推荐 【持续更新...】
android·前端·react native
apihz6 小时前
通用图片搜索-搜狗源免费API接口使用指南
android·java·python·php·音视频
你过来啊你7 小时前
Android开发中ARouter使用和原理详解
android