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

}

相关推荐
时间的拾荒人24 分钟前
MySQL 视图详解
android·数据库·mysql
祉猷并茂,雯华若锦1 小时前
Appium 3.x安卓按键与通知栏操作全指南
android·appium
码农coding2 小时前
android 12 SurfaceFlinger开机启动分析
android
hunterandroid2 小时前
Paging 3 RemoteMediator 实战:构建离线优先的分页列表
android·前端
码农coding2 小时前
android12 开机启动PMS
android
Days20502 小时前
GPT-Image-2 国风美学人设生成提示词分享
android·gpt
浮江雾3 小时前
Flutter第十节-----Flutter布局与组件全解析
android·开发语言·前端·学习·flutter·入门
Jomurphys3 小时前
Compose 适配 - 自适应布局(窗口大小类 WindowSizeClasses、列表详情、辅助窗格)
android·compose
plainGeekDev4 小时前
synchronized → Coroutines
android·java·kotlin
sun0077004 小时前
gtest 行覆盖率、函数覆盖率、分支覆盖率 . 一般这3个要达到多少?算达标
android