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

}

相关推荐
allk5513 分钟前
Android 性能优化之启动加速:从底层原理到架构治理
android
QuantumLeap丶34 分钟前
《Flutter全栈开发实战指南:从零到高级》- 24 -集成推送通知
android·flutter·ios
用户416596736935538 分钟前
WebView 滚动失灵?剖析 `scrollBy()` 在现代 Web 布局中的失效陷阱
android
明川1 小时前
Android Gradle学习 - Gradle插件开发与发布指南
android·前端·gradle
二流小码农2 小时前
鸿蒙开发:上架困难?谈谈我的上架之路
android·ios·harmonyos
Propeller2 小时前
【Android】动态操作 Window 的背后机制
android·java
张风捷特烈2 小时前
Flutter&TolyUI#12 | 树形组件 toly_tree 重磅推出!
android·前端·flutter
柯南二号2 小时前
【大前端】【Android】一文详解Android MVVM 模式详情解析
android·前端
feathered-feathered2 小时前
Redis【事务】(面试相关)与MySQL相比较,重点在Redis事务
android·java·redis·后端·mysql·中间件·面试