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

}

相关推荐
来来走走20 分钟前
Android开发(Kotlin) LiveData的基本了解
android·开发语言·kotlin
。puppy1 小时前
MySQL 远程登录实验:通过 IP 地址跨机器连接实战指南
android·adb
dongdeaiziji2 小时前
深入理解 Kotlin 中的构造方法
android·kotlin
风起云涌~2 小时前
【Android】浅谈Navigation
android
游戏开发爱好者82 小时前
iOS 商店上架全流程解析 从工程准备到审核通过的系统化实践指南
android·macos·ios·小程序·uni-app·cocoa·iphone
QuantumLeap丶5 小时前
《Flutter全栈开发实战指南:从零到高级》- 18 -自定义绘制与画布
android·flutter·ios
.豆鲨包5 小时前
【Android】 View事件分发机制源码分析
android·java
花落归零5 小时前
Android 小组件AppWidgetProvider的使用
android
弥巷5 小时前
【Android】常见滑动冲突场景及解决方案
android·java
angushine5 小时前
解决MySQL慢日志输出问题
android·数据库·mysql