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

}

相关推荐
mmsx16 分钟前
Android 地图上绘制 KML:解析、样式与渲染
android·xml
运行时异常26 分钟前
【无标题】
android
右手吉他1 小时前
高通平台IA APN问题分析之一
android·物联网
a5986522 小时前
Docker多开云手机,六边云独立端口隔离访问实战
android·运维·docker·容器·智能手机·云手机
峥嵘life2 小时前
Android16 开机后立即打开相机闪退问题分析与解决总结
android·开发语言·数码相机·策略模式
用户2018792831672 小时前
从点击图标到首帧"上菜":一篇吃透 Android 启动优化原理
android
镜象科技3 小时前
职业院校AI心理健康解决方案是什么?从一台设备到全周期守护
android·人工智能
码上有光4 小时前
Linux:信号的认识、信号的产生、信号的保存、信号的处理
android·linux·运维·信号