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

}

相关推荐
年小个大14 小时前
受 go-zero 启发,我给 Flutter 写了一套 CLI 脚手架
android·flutter·架构
Android-Flutter15 小时前
为什么说ActivityThread是主线程?
android·kotlin
余额瞒着我当琳17 小时前
C++模板初阶与STL初探
android·java·c++
知行合一。。。19 小时前
DeepAgents--01--Agent和OpenClaw的相关概念
android·数据库
汪海游龙21 小时前
告别 Play Console 手动上传:从模拟器截图到自动发版的完整流水线
android·ci/cd·github
weixin_4407841121 小时前
【IntentSeivice实现原理】
android·java·开发语言·intentservice
delta_hell21 小时前
【阅读源码--Android】动画之ValueAnimator--2
android·源码·valueanimator
delta_hell21 小时前
【阅读源码--Android】动画之辅助类
android·源码·animator
delta_hell1 天前
【阅读源码--Android】动画之ValueAnimator--1
android·源码·valueanimator
消失的旧时光-19431 天前
第 2 篇:Android 控制屏为什么与机器人主控使用 TCP 长连接?
android·tcp/ip·机器人