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

}

相关推荐
summerkissyou198713 小时前
Android-UI-获取屏幕尺寸的方法
android·ui
用户860225046747213 小时前
Kotlin 函数式编程入门与实践指南
android
最爱睡觉睡觉睡觉15 小时前
CSS → Flutter 对照手册
android·前端
xingpanvip16 小时前
星盘接口开发文档:马盘次限盘接口指南
android·开发语言·python·php·lua
用户261904985615716 小时前
JUnit4 完整配置流程
android
用户261904985615716 小时前
JaCoCo 完整配置流程
android
QING61817 小时前
Android面试 —— 八股文之app启动流程
android·面试·app
海鸥-w17 小时前
python(fastapi) 实现更新,新增,删除接口
android·python·fastapi
le16161617 小时前
Android Compose Modifier修饰符
android·compose·modifier
黄林晴17 小时前
Android17新规:内存超限直接杀App,没有崩溃日志怎么排查?
android