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

}

相关推荐
_祝你今天愉快1 小时前
Android 高级绘制:[四] Canvas-实际案例操作
android
三少爷的鞋2 小时前
Android 工程师的技术信仰崩塌史
android
AirDroid_cn4 小时前
Android 15 权限回溯:已授予的麦克风权限如何批量回收?
android
Mr_万能胶5 小时前
官方发布,不烧心的 AOSP 编译提速技巧
android·ci/cd·架构
booboosui5 小时前
安卓 8.1 也能装了:代价是一条黄字和两个静默 bug
android
Ehtan_Zheng8 小时前
Jetpack AppState Transform:让 Compose 的响应式状态走出 UI 层
android
yyuuuzz10 小时前
nginx 502 排查,先看上游超时那一行
android·java·运维·nginx·502
恋猫de小郭14 小时前
Flutter 3.50.0 Release 的第一个崩溃,修好了,还没 hotfix
android·前端·flutter
alexhilton1 天前
MVI 让屏幕一次只有一个状态
android·kotlin·android jetpack
二流小码农1 天前
鸿蒙开发:证书只能创建3个,第4个应用怎么办
android·ios·harmonyos