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

}

相关推荐
yzpyzp14 小时前
kotlin的函数前面增加suspend关键字的作用
android·开发语言·kotlin
jiet_h14 小时前
Android Kotlin ObjectAnimator 和 ValueAnimator 全面解析
android·开发语言·kotlin
Android技术之家14 小时前
Kotlin与Compose:Android开发的现代化变革
android·java·开发语言·kotlin
诸神黄昏EX15 小时前
Android SystemServer 系列专题【篇五:UserController用户状态控制】
android
2501_9160074715 小时前
Transporter App 使用全流程详解:iOS 应用 ipa 上传工具、 uni-app 应用发布指南
android·ios·小程序·https·uni-app·iphone·webview
叽哥16 小时前
Kotlin学习第 5 课:Kotlin 面向对象编程:类、对象与继承
android·java·kotlin
叽哥16 小时前
Kotlin学习第 6 课:Kotlin 集合框架:操作数据的核心工具
android·java·kotlin
大白的编程日记.17 小时前
【MySQL】表的操作和数据类型
android·数据库·mysql
前行的小黑炭17 小时前
Android LayoutInflater 是什么?XML到View的过程
android·java·kotlin
尚久龙17 小时前
安卓学习 之 SeekBar(音视频播放进度条)
android·java·学习·手机·android studio