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

}

相关推荐
二流小码农4 小时前
鸿蒙开发:router组件升级,彻底告别手动配置
android·ios·harmonyos
Digitally4 小时前
如何在安卓设备上使用 4 种简单方法将应用移动到 SD 卡
android
booboosui6 小时前
录一遍就会:8 种步骤、6 类失败,卡住时只修那一步
android
阿杰m6 小时前
Android源码第十五章:Camera2 与 CameraService——一帧图像怎样回到应用
android
恋猫de小郭12 小时前
Flutter Analyzer 系列坑推进,必看,AI 时代这玩意最吃你内存
android·前端·flutter
LinXunFeng1 天前
拿竞品 App 一扫,技术栈全暴露了
android·flutter·开源
Gracker1 天前
AIW:从系统机制到性能排查,一本可以对照源码的 Android 电子书
android
三少爷的鞋1 天前
代码越来越便宜,判断力越来越贵:AI 时代的 Android 架构与协程避坑指南
android
Gracker1 天前
SmartPerfetto 1.19.0:换过分析引擎之后,这次更新了什么
android
HQL_seven1 天前
【Android】BroadcastReceiver 详解
android