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 小时前
Linux — 进程控制
android·linux·运维
俩个逗号。。1 天前
Gradle 踩过的坑
android
土星碎冰机1 天前
ai自学笔记(3.安卓篇,制作app
android·笔记·ai
随遇丿而安1 天前
专题:Glide / Coil / Fresco,不是三种写法,而是三套图片加载思路
android
只可远观1 天前
Android 自动埋点(页面打开 / 关闭 + 点击事件)完整方案
android·kotlin
私人珍藏库1 天前
【Android】小小最新AI--千变万化扮演任何角色--沉浸式互动
android·app·工具·软件·多功能
zh_xuan1 天前
Android MVI架构
android·mvi
测试开发-学习笔记1 天前
Airtest+Poco快速上手
android·其他
李斯维1 天前
Android Jetpack 简介:由来和演进
android·android studio·android jetpack
阿巴斯甜1 天前
ARouter 的使用:
android