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

}

相关推荐
zh_xuan5 小时前
Android Hilt实现依赖注入
android·hilt
freshman_y5 小时前
Qtcreator怎么新建安卓项目?编写一个五子棋游戏APP?
android·qt
时寒的笔记6 小时前
js逆向7_案例惠nong网
android·开发语言·javascript
肯多洛夫斯基7 小时前
安卓工控屏静默连WiFi全攻略
android
极梦网络无忧7 小时前
Android无障碍服务实现抖音直播间界面监控(场控助手核心原理)
android
call me by ur name8 小时前
ERNIE 5.0 Technical Report论文解读
android·开发语言·人工智能·机器学习·ai·kotlin
kerli9 小时前
Compose 组件:Box 核心参数及其 Bias 算法
android·前端
BLUcoding9 小时前
Android 常用控件及核心属性
android
遥不可及zzz9 小时前
[特殊字符] Android AAB 一键安装工具配置指南
android·macos
私人珍藏库9 小时前
【Android】一键硬核锁手机
android·智能手机·app·工具·软件