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

}

相关推荐
李艺为40 分钟前
Android Studio使用switch匹配资源id时报需要常量表达式解决办法
android
YaBingSec2 小时前
玄机靶场-2024ccb初赛sc05 WP
android·运维·网络·笔记·安全·ssh
常利兵3 小时前
解锁Android嵌入式照片选择器,让你的App体验丝滑起飞
android
峥嵘life3 小时前
Android 切换用户后无法获取 MAC 地址分析解决
android·python·macos
JJay.3 小时前
Android BLE 为什么连上了却收不到数据
android
歪楼小能手3 小时前
Android16在开机向导最后添加一个声明界面
android·java·平板
夏沫琅琊3 小时前
Android联系人导入导出
android·kotlin
zh_xuan3 小时前
把Android Library 上传到github并在工程中引用该远程仓库
android·github·远程仓库
诸神黄昏EX3 小时前
Android Google MADA
android
盖丽男3 小时前
使用 GitHub Actions 自动打包 Android APK
android·github