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

}

相关推荐
程序员陆业聪19 小时前
两次Flutter全屏白踩坑复盘:Layout的静默失败,以及AI结对编程的认知盲区
android
程序员陆业聪20 小时前
Compose Strong Skipping Mode 的真相:它并不会让你的类型变 Stable
android
shaoming37761 天前
浏览器动作开发:地址栏图标点击事件、弹出页面设计
android·mysql·adb
赏金术士1 天前
Kotlin 协程与挂起函数(Coroutines & suspend)入门到实战
android·开发语言·kotlin
泡泡以安1 天前
Unidbg学习笔记(十三):固定随机干扰项
android·逆向
泡泡以安1 天前
Unidbg学习笔记(十六):Console Debugger
android·逆向
赏金术士1 天前
Room + Flow 完整教程(现代 Android 官方方案)
android·kotlin·room·compose
泡泡以安1 天前
Unidbg学习笔记(八):文件系统层补环境
android·逆向
泡泡以安1 天前
Unidbg学习笔记(六):补环境的思维框架
android·逆向
通往曙光的路上1 天前
mysql2
android·adb