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

}

相关推荐
用户860225046747211 小时前
从入门到进阶的 React Native 实战指南
android·前端
沐言人生11 小时前
ReactNative 源码分析10——Native View创建流程createView
android·react native
问心无愧051311 小时前
ctf show web入门98
android·前端·笔记
李斯维11 小时前
Jetpack 生命周期组件 Lifecycle 的设计思想和使用
android·android studio·android jetpack
Mr YiRan12 小时前
Android构建优化:基于Git Diff+TaskGraph
android·git·elasticsearch
赏金术士12 小时前
第二章:Compose入门—声明式UI编程
android·ui·kotlin·compose
星间都市山脉12 小时前
Android 谷歌 VTS 完整测试
android
齊家治國平天下12 小时前
Android 14 AIDL HAL 使用指南-获取服务流程解析
android·hal·aidl·servicemanager·aidl hal·获取服务
张二娃同学12 小时前
02_C语言数据类型_整型浮点型字符型一次讲清楚
android·java·c语言
lf28248143112 小时前
07 AD9361自发自收PL工程搭建
android