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

}

相关推荐
我命由我1234528 分钟前
Android Jetpack Compose - enableEdgeToEdge 函数、MaterialTheme 函数、remember 函数
android·java·java-ee·kotlin·android studio·android jetpack·android-studio
2501_9159214336 分钟前
没有 iOS 源码的前提下如何进行应用混淆,源码混淆失效后的替代
android·ios·小程序·https·uni-app·iphone·webview
林栩link1 小时前
【车载Android】多媒体开发入门(上) - MediaSession
android·android jetpack
GoldenPlayer1 小时前
OKHTTP连接保持
android
我有与与症1 小时前
用 KuiklyUI Canvas 打造天气预测图表
android
冬奇Lab1 小时前
稳定性性能系列之八——系统性能分析基础:Systrace与Perfetto入门
android·性能优化
程序员码歌1 小时前
短思考第268天,自媒体路上的4大坑点,很多人都踩过
android·前端·ai编程
消失的旧时光-19433 小时前
从 Android 组件化到 Flutter 组件化
android·flutter·架构
Android轮子哥3 小时前
Android 12 SplashScreen 一种另类的适配方案
android·github
粤M温同学4 小时前
Android OkHttp 下载限速方案实现
android·okhttp