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

}

相关推荐
小馬佩德罗29 分钟前
Android 系统的兼容性测试 - CTS
android·cts
缘来的精彩1 小时前
Android ARouter的详细使用指南
android·java·arouter
风起云涌~1 小时前
【Android】ListView控件在进入|退出小窗下的异常
android
syy敬礼1 小时前
Android菜单栏
android
大风起兮云飞扬丶1 小时前
Android——RecyclerView
android
dongpingwang1 小时前
android10 卸载应用出现回退栈异常问题
android
_一条咸鱼_1 小时前
深度剖析:Android SurfaceView 使用原理大揭秘
android·面试·android jetpack
_一条咸鱼_9 小时前
深度揭秘!Android HorizontalScrollView 使用原理全解析
android·面试·android jetpack
_一条咸鱼_9 小时前
揭秘 Android RippleDrawable:深入解析使用原理
android·面试·android jetpack
_一条咸鱼_9 小时前
深入剖析:Android Snackbar 使用原理的源码级探秘
android·面试·android jetpack