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

}

相关推荐
太阳之影17 分钟前
android6使用termux以及termux-api笔记
android·笔记·termux
胖咕噜的稞达鸭1 小时前
Linux系统编程:文件系统(CHS LBA地址,Block Group 软硬连接,手搓简化版本的FILE结构体)
android·linux·数据库
坚持学习前端日记1 小时前
UniApp APK打包与Android深度集成能力解析
android·vue.js·uni-app
恋猫de小郭1 小时前
Android Studio 的 AI Agent 有什么特别?未来会有惊艳什么功能?
android·前端·flutter
2501_9466756412 小时前
Flutter与OpenHarmony打卡时间选择器组件
android·javascript·flutter
Jomurphys16 小时前
Compose 封装 - 点击防抖
android
乾坤一气杀18 小时前
OkHttp3 内部工作原理时序图
android
一起搞IT吧19 小时前
相机拍照无响应问题分析一:【MEMORY_NOT_ENOUGH导致】持续快拍,一会儿无法拍照了
android·c++·数码相机·智能手机
是店小二呀20 小时前
【MySQL】MySQL 从安装到理解
android·mysql·adb
we1less21 小时前
[audio] threadLoop_write 到 audio-hal 分析
android