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

}

相关推荐
松仔log11 分钟前
Kotlin中级——KMP
android·开发语言·kotlin
GY-9315 分钟前
【Android】SQL数据库
android
GY-931 小时前
【Android】适配不同的屏幕尺寸
android
Chenpip12 小时前
安卓 14/15 上装不上:四层原因与三行检查
android·app分发·应用分发·海哈游分发·内测
TT哇2 小时前
【Android 之旅】Android 通俗易懂记
android·gitee
雨白3 小时前
工厂设计模式实战:从简单工厂到抽象工厂的演进之路
android
Digitally3 小时前
7 种主流安卓设备备份与恢复方法
android
恋猫de小郭3 小时前
Flutter HC 旋转 ANR,而且还和之前的 HCPP 问题类似
android·前端·flutter
Digitally3 小时前
如何在安卓设备上备份和恢复通话记录:完整指南
android
StarsGreen3 小时前
Android 的graphicsstats 服务讲解
android