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

}

相关推荐
美狐美颜SDK开放平台25 分钟前
开发直播APP、电商短视频与视频社交平台时,能否共用一套美颜SDK?
android·图像处理·人工智能·音视频·直播美颜sdk
事圆则缓38 分钟前
Android 中的 MQTT 协议:从设备状态推送到可靠消息处理
android
三雷科技1 小时前
Android 开发环境搭建指南
android
赵庆明老师1 小时前
Android Studio Google源代理配置
android·ide·android studio
事圆则缓2 小时前
Android 核心名词手册跟读版
android
snysy2 小时前
WordPress伪静态404故障排查笔记
android·笔记·wordpress
zhangphil2 小时前
海量小文件造成Android存储碎片化与I/O变慢
android
Kapaseker2 小时前
Kotlin 2.5 Value Class 终于能放多个属性了
android·kotlin
恋猫de小郭3 小时前
Flutter Android 性能修复:8 个大核的手机,Raster 居然只跑在 2 个核上?
android·flutter
传奇开心果编程15 小时前
【Jetpack Compose娓娓道来】第29课:状态容器与UI事件建模——把“散装状态”变成“可穷举的契约”
android·kotlin·移动开发·android jetpack·ui框架·开发范式·声明式ui