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

}

相关推荐
YB13758 小时前
jetpack compose 副作用 SideEffect
android·kotlin
CHB9 小时前
uni-app x 蒸汽模式 性能测试基准报告 Benchmark【Android版】
android·ios·uni-app
带娃的IT创业者11 小时前
拆掉那堵墙:LibrePods 如何让 AirPods 在 Android 上重获新生
android·开源项目·airpods·librepods·生态解锁
_阿南_12 小时前
flutter 展示的字体突然奔放了
android·flutter·ios
文人sec15 小时前
MySQL事务与索引做了什么?
android·笔记·mysql
刘洋浪子16 小时前
AndroidStudio保存日志菜单
android
朱涛的自习室16 小时前
从 Prompt 到 Graph:AI 工程的进化史
android·前端·人工智能
2501_9327502616 小时前
Android 中 Serializable 与 Parcelable 的对比与选择
android
FungLeo17 小时前
Flutter 两个反直觉布局坑:ListTile 水波纹 / VerticalDivider 踩坑实录
android·flutter
1570925113418 小时前
ViewBinding与DataBinding区别与选型
android