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

}

相关推荐
StarsGreen1 小时前
Android中的seccomp相关信息介绍
android
阿杰m5 小时前
Android源码第二十四章:OTA 与 APEX——重启后换了什么?
android
用户081268037416 小时前
差点格式化一台 Redmi K80:一次 WebView 翻车的无损救援实录
android·debug·webview
阿杰m6 小时前
Android源码第二十五章:WebView 与 Chromium——网页何时画上屏?
android·android studio
StarsGreen6 小时前
Android中特殊文件的相关说明
android
Digitally8 小时前
6 款优质安卓备份提取工具与备份方案
android
恋猫de小郭11 小时前
Flutter A2UI 1.0 ,原来的 genui 也正式换成了这一套 SDK 了
android·前端·flutter
Wellijohn1 天前
一个 Android 老兵的十年开源路:从 167 star 的滑动控件,到本地优先的 AI Agent
android·人工智能·开源
好的佩奇1 天前
Dart 之元数据与注解
android·flutter·dart
三少爷的鞋1 天前
很多开发者把物理上的分层,当成了架构
android