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 分钟前
蓝牙之 GATT 数据操作
android·flutter·蓝牙
三少爷的鞋1 小时前
Android 面试系列之-lifecycleScope 和 CoroutineScope(Dispatchers.Main)
android
Mars-xq3 小时前
Android studio下载很慢download fail
android·ide·android studio
2501_915909064 小时前
iOS 上架 App Store 后推送收不到,APNs 证书和生产沙盒环境排查
android·小程序·https·uni-app·iphone·webview
吃不胖爹4 小时前
安卓原生开发的app如何打包成应用
android
ZHOUPUYU6 小时前
PHP 现代工程实践:从语言特性到高性能 Web 应用构建
android·前端·php
treasure1407 小时前
Flutter低级教程(2027年1月重制版)
android·flutter·ios·gui·web·dart·移动端
艾派森8 小时前
Python帕累托分析实战:用二八法则找出贡献80%营收的核心商品
android·开发语言·python
橙光成长9 小时前
GameScrcpy:不装模拟器,用键鼠手柄和 TypeScript 脚本接管你的安卓手游
android·javascript·typescript·开源·1024程序员节
ZHOUPUYU10 小时前
PHP 实战:从零构建一个高可用的小型 Web 应用
android·前端·php