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

}

相关推荐
zhangphil13 小时前
Android Page 3 Flow读sql数据库媒体文件,Kotlin
android·kotlin
神探小白牙13 小时前
echarts,3d堆叠图
android·3d·echarts
李白的天不白13 小时前
如何项目发布到github上
android·vue.js
summerkissyou198713 小时前
Android-RTC、NTP 和 System Time(系统时间)
android
小书房14 小时前
Kotlin使用体验及理解1
android·开发语言·kotlin
撩得Android一次心动14 小时前
Android Navigation 组件全面讲解
android·jetpack·navigation
向阳是我14 小时前
Flutter Android 编译错误修复:JVM Target Compatibility 不一致问题记录
android·jvm·flutter
Kapaseker14 小时前
我想让同事知道我很懂 Compose 怎么办?
android·kotlin
小肝一下15 小时前
3. 数据类型
android·数据库·mysql·adb
a2591748032-随心所记15 小时前
android拆解super.img内容
android·linux·运维·服务器