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

}

相关推荐
启雀AI12 小时前
培训平台移动端离线学习方案设计与实现:视频缓存、断点续传与进度同步的工程实践
android·学习·缓存·音视频·企业lms
我命由我1234513 小时前
RxJava - 冷数据流与热数据流
android·java·java-ee·android studio·rxjava·android-studio·android runtime
2601_9665635215 小时前
愤怒的小鸟单机版 去广告 安卓+PC端离线纯净版 益智耐玩小游戏 不需联网 老旧手机都可以玩 怀旧手机小游戏
android·智能手机
hunterandroid15 小时前
[Android 从零到一] Retrofit 请求取消与生命周期绑定:从 Call.cancel 到协程可取消设计
android
爱跑马的程序员16 小时前
安卓专有的通信子系统-Binder IPC
android·binder·ipc·安卓间通信机制
ue星空16 小时前
【安卓逆向】为什么用Frida?
android
小驰行动派17 小时前
Camx架构全景图:从V4L2到Pipeline的完整拆解
android·camera·android camera
hunterandroid17 小时前
[Android 从零到一] Custom View 触摸反馈与手势冲突解决
android
coderSong256818 小时前
Android | 四大组件之 BroadcastReceiver(广播接收器)
android
爱笑鱼21 小时前
Android 系统启动机制(二):init.rc 不是普通脚本,service、action 和 property 怎样驱动启动?
android