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

}

相关推荐
张筱竼16 小时前
Android开发中的MVC、MVP与MVVM详解
android
阿巴斯甜19 小时前
必看4
android
Carson带你学Android19 小时前
Android 17 最后一个 Beta 发布,7 件事必须现在做
android·ai编程
ooseabiscuit19 小时前
Laravel 9.x重磅升级:PHP8新特性全解析
android
帅次19 小时前
深入 MaterialTheme:掌握 ColorScheme 与 Typography 的设计核心
android·kotlin·gradle·android jetpack·compose
阿巴斯甜19 小时前
必看2
android
重生之小比特20 小时前
【MySQL 数据库】复合查询
android·数据库·mysql
用户860225046747220 小时前
Jetpack Activity 完整示例教程
android
simplepeng20 小时前
如何减少 89% 的重组,每个Compose开发者都需要的技巧 - derivedStateOf
android·android jetpack