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

}

相关推荐
&岁月不待人&17 小时前
⏺ Android 录屏缩放异常排查:Pixel 3 XL 上的完美风暴
android
a31582380617 小时前
Android 大图显示策略优化显示(一)
android·算法·图片加载·大图片
tangweiguo0305198717 小时前
从零开始:在 Windows 上使用命令行编译 Android .so 动态库(NDK + CMake + Ninja)
android
阿波罗尼亚17 小时前
Tcp SSE Utils
android·java·tcp/ip
知行合一。。。21 小时前
Python--03--函数入门
android·数据库·python
大、男人1 天前
python之contextmanager
android·python·adb
不法1 天前
java查看安卓证书信息
android
儿歌八万首1 天前
Jetpack Compose 动画实战:让你的 UI 动起来
android·kotlin·动画·compose
千里马学框架1 天前
如何改进车载三分屏SplitScreen启动交互方式?
android·智能手机·分屏·aaos·安卓framework开发·车载开发·3分屏
REDcker1 天前
Android WebView 版本升级方案详解
android·音视频·实时音视频·webview·js·编解码