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

}

相关推荐
wen_zhufeng1 小时前
用 vLLM 加速 TTS 推理:通用改造指南
android·vllm
长友cy3 小时前
windows 搭建Qt编译Android 应用程序,快速搭建
android·windows
智驭未来掌门人4 小时前
Android Kotlin 开发避坑指南:从语言特性到工程化实践
android
码农coding4 小时前
android12 ViewRootImpl分析
android
stevenzqzq4 小时前
compose项目返回到当前页面闪烁原因分析
android
古法安卓5 小时前
Android-显示流程
android·java·android studio
CircleMouse5 小时前
画一个Android智能手机机器人
android·智能手机·机器人
数据知道6 小时前
PHP 代码审计实战——ThinkPHP、Laravel 历史漏洞模式深度剖析
android·网络·web安全·网络安全·php·laravel
拍客圈6 小时前
换服务器 mozcjpeg 5.0.0
android
蜡台8 小时前
Jetpack Compose 稳定性、重组优化(Stable / @NonRestartableComposable)
android·kotlin·compose·jepack