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

}

相关推荐
雨白5 小时前
嵌套 ScrollView 滑动冲突实战:实现内部优先滚动
android
阿pin5 小时前
Android随笔-IntentService详解(了解)
android·intentservice
海天鹰5 小时前
content://com.android.externalstorage.documents/document/primary%3A
android
阿pin6 小时前
Android随笔-WorkManager 与 AlarmManager
android·alarmmanager·workmanager
帅帅的记忆7 小时前
uniapp项目调用原生android studio的sdk文件(即aar文件)
android·uni-app·android studio
天才少年曾牛7 小时前
Android16在状态栏顶部新增图标(SystemUI)
android·frameworks
用户69371750013847 小时前
Kimi K3 综合能力处于全球第一梯队
android·前端·后端
阿pin7 小时前
Android随笔-BroadcastReceiver
android·broadcast
pengyu8 小时前
【Kotlin 协程修仙录 · 金丹境 · 后阶】 | 异常防火墙:supervisorScope 与异常隔离的终极奥义
android·kotlin
cheng2191019 小时前
Cocos Creator打包安卓并支持 Android 16KB 页面大小
android