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

}

相关推荐
不吃凉粉13 分钟前
Android Studio USB串口通信
android·ide·android studio
zhangphil15 分钟前
android studio设置大内存,提升编译速度
android·android studio
编程乐学1 小时前
安卓非原创--基于Android Studio 实现的天气预报App
android·ide·android studio·课程设计·大作业·天气预报·安卓大作业
大熊的瓜地3 小时前
Android automotive 框架
android·android car
私人珍藏库4 小时前
[Android] Alarm Clock Pro 11.1.0一款经典简约个性的时钟
android·时钟
消失的旧时光-19436 小时前
ScheduledExecutorService
android·java·开发语言
小糖学代码6 小时前
MySQL:14.mysql connect
android·数据库·mysql·adb
怪兽20148 小时前
请谈谈什么是同步屏障?
android·面试
帅锅锅0079 小时前
SeLinux 全面详解
android·linux
只想搞钱的肥仔9 小时前
Android thermal (5)_cooling device(下)
android