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

}

相关推荐
-SOLO-6 小时前
停止gradle命令
android
_祝你今天愉快6 小时前
Android Binder 驱动 - 启动 ServiceManager 进程
android
农村小镇哥6 小时前
ThinkPHP-MVC什么是框架
android
换元不配限7 小时前
Jetpack Compose 状态管理指南
android·状态管理·compose·状态·单向数据流·jetpack compose·状态容器
爱笑鱼10 小时前
JNI(二):Java 里的一个 long,为什么能找到 C++ 对象?
android
爱笑鱼10 小时前
JNI(一):nativePollOnce() 到底去了哪里?
android
hqk12 小时前
玩Android×AI Coding:从产品到代码,完整跑通一套 AI 软件研发工作流
android·ai编程·vibecoding
安卓修改大师13 小时前
安卓修改大师实战:深入解析Android主题Theme修改与沉浸式界面实现
android
齊家治國平天下14 小时前
CarService 深度解析 —— 基于 Android 14
android·车载系统·aaos·carservice·电源管理·android 14·vhal
stevenzqzq15 小时前
app性能日志工具
android