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

}

相关推荐
gregmankiw15 分钟前
Nemotron架构(Mamba3+Transformer+Moe)
android·深度学习·transformer
xianjian09122 小时前
MySQL 的 INSERT(插入数据)详解
android·数据库·mysql
欧简墨3 小时前
kotlin Android Extensions插件迁移到viewbinding总结
android·trae
货拉拉技术3 小时前
优雅解决Android app后台悬浮窗权限问题
android
用户69371750013844 小时前
Android 手机终于能当电脑用了
android·前端
用户5172231574805 小时前
android资源类型与布局资源详细介绍
android
优选资源分享5 小时前
GKD v1.11.6 | 安卓开屏广告跳过工具 可用版
android
robotx5 小时前
安卓zygote启动相关
android
Mac的实验室6 小时前
2026年最新真实社交怎么注册?手把手教你如何成功注册Truth Social账号
android
毕设源码-郭学长7 小时前
【开题答辩全过程】以 基于Android的点餐APP的设计为例,包含答辩的问题和答案
android