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

}

相关推荐
你听得到111 小时前
排查 App 问题:别只盯着报错,把前后发生的事情串起来
android·前端·flutter
淡淡的香烟2 小时前
Android智能猫砂盆视频加载慢卡顿问题分析
android·服务器·音视频
Xxtaoaooo2 小时前
从故障诊断到寿命预测:用 DolphinDB 构建工业设备的预测性维护管线
android·故障诊断·dolphindb·工业设备·寿命预测
天空之城--2 小时前
近一周Android Flutter行业动态与实用参考
android·flutter
Everbrilliant892 小时前
Android FFmpeg 实战:从基础到播放器的完整技术解析
android·ffmpeg·ffmepg实战·音视频同步实现·ffmpegpractices·ffmpegpractice·opengl 视频渲染
alexhilton13 小时前
Android XR 开发入门完全指南
android·kotlin·android jetpack
2501_9159090618 小时前
全面解析iOS应用上架到App Store的完整流程与关键注意事项
android·macos·ios·小程序·uni-app·cocoa·iphone
淡淡的香烟20 小时前
AndroidAI使用心得
android
chjif21 小时前
Android 设备管控开发实战:无障碍如何准确识别当前前台 App?
android
chjif21 小时前
Android 设备管控开发实战:企业受控终端的 DNS 域名策略实现
android·华为·harmonyos