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

}

相关推荐
山山而川 潺潺如镜29 分钟前
python防止程序多开,但程序运行脚本
android·开发语言·python
花开彼岸天~1 小时前
Flutter跨平台开发:Android View 在鸿蒙系统上的使用指南
android·flutter·harmonyos
子一!!1 小时前
MySQL==表的结构操作1
android·python·adb
你不是我我1 小时前
【Java 开发日记】我们来说一下 MySQL 的慢查询日志
android·java·mysql
梦幻通灵10 小时前
Mysql字段判空实用技巧
android·数据库·mysql
龘龍龙12 小时前
Python基础(九)
android·开发语言·python
gjc59213 小时前
MySQL隐蔽 BUG:组合条件查询无故返回空集?深度排查与规避方案
android·数据库·mysql·bug
梨落秋霜14 小时前
Python入门篇【元组】
android·数据库·python
zh_xuan14 小时前
kotlin定义函数和变量
android·开发语言·kotlin
Digitally15 小时前
Android 上的联系人备份和恢复:5 种可靠且方便的方法
android