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

}

相关推荐
海兰4 小时前
【实战】MCP 服务在 Nacos 中注册状态分析与优化
android·java·github·银行系统·银行ai
bearpping4 小时前
MySQL压缩版安装详细图解
android·mysql·adb
代码改善世界5 小时前
【matlab初阶】matlab入门知识
android·java·matlab
huwuhang7 小时前
支付宝 APP 谷歌商店版 googleplay版最新
android
User_芊芊君子7 小时前
别再乱用 ArrayList 了!这 4 个隐藏坑,90% 的 Java 开发者都踩过
android·java·数据库
冬天vs不冷7 小时前
为什么 Java 不让 Lambda 和匿名内部类修改外部变量?final 与等效 final 的真正意义
android·java·开发语言
hogenlaw9 小时前
Stream流
android·java·开发语言
常利兵10 小时前
解锁Kotlin:数据类与密封类的奇妙之旅
android·开发语言·kotlin
sunfdf11 小时前
无需密码即可解锁 Android 手机的 5 种方法
android·智能手机
Ln5x9qZC213 小时前
Laravel AI SDK 正式发布
android·人工智能·laravel