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

}

相关推荐
问心无愧051317 分钟前
ctf show web入门101
android·前端·笔记
一池秋_20 分钟前
chroot-debian一键部署
android·容器·debian
超梦dasgg23 分钟前
APP 壳、加固、脱壳 完整通俗讲解(安卓为主,兼顾 iOS)
android·ios
猪脚饭还是好吃的40 分钟前
【分享】C4droid 安卓C++编译器 手机编程超便捷
android·c++·智能手机
AI浩41 分钟前
【数据处理】基于 SAM3 的 LabelMe 标注统一校正方法
android·开发语言·kotlin
恋猫de小郭41 分钟前
真正的跨平台 AI 自动化框架,甚至还支持鸿蒙
android·前端·flutter
私人珍藏库1 小时前
【Android】 VidFetch一键下载各大平台视-内置播放器
android·app·工具·软件·多功能
2501_932750261 小时前
Android Activity 生命周期解析
android
猪脚饭还是好吃的2 小时前
【分享】VideoGuru视频编辑 裁剪拼接,合并调速 解锁会员
android
三少爷的鞋2 小时前
避免 Flow + combine 的首值陷阱:用 StateFlow 保证 UI 始终有状态
android