android 城市列表 横屏,Android Launcher3去掉所有应用列表,横屏时左右两侧的留空...
下面是编程之家 jb51.cc 通过网络收集整理的代码片段。编程之家小编现在分享给大家,也给大家做个参考。// Layout AllAppsAppsCustomizeTabHost host = (AppsCustomizeTabHost)launcher.findViewById(R.id.apps_customize_pane);if (host != null) {// Center the
下面是编程之家 jb51.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
// Layout AllApps
AppsCustomizeTabHost host = (AppsCustomizeTabHost)
launcher.findViewById(R.id.apps_customize_pane);
if (host != null) {
// Center the all apps page indicator
int pageIndicatorHeight = (int) (pageIndicatorHeightPx * Math.min(1f,(allAppsIconSizePx / DynamicGrid.DEFAULT_ICON_SIZE_PX)));
pageIndicator = host.findViewById(R.id.apps_customize_page_indicator);
if (pageIndicator != null) {
lp = (FrameLayout.LayoutParams) pageIndicator.getLayoutParams();
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
lp.width = LayoutParams.WRAP_CONTENT;
lp.height = pageIndicatorHeight;
pageIndicator.setLayoutParams(lp);
}
AppsCustomizePagedView pagedView = (AppsCustomizePagedView)
host.findViewById(R.id.apps_customize_pane_content);
padding = new Rect();
if (pagedView != null) {
// Constrain the dimensions of all apps so that it does not span the full width
// TChip ZJ Add START: 去掉所有应用列表,横屏时左右两侧的Margin
int paddingLR = (availableWidthPx - (allAppsCellWidthPx * allAppsNumCols)) /
(2 * (allAppsNumCols + 1));
int paddingTB = (availableHeightPx - (allAppsCellHeightPx * allAppsNumRows)) /
(2 * (allAppsNumRows + 1));
paddingLR = Math.min(paddingLR,(int)((paddingLR + paddingTB) * 0.75f));
paddingTB = Math.min(paddingTB,(int)((paddingLR + paddingTB) * 0.75f));
paddingLR = (int)(paddingLR * 0.75f);
paddingTB = (int)(paddingTB * 0.75f);
// TChip ZJ Add END
// TChip ZJ Minus START: 去掉所有应用列表,横屏时左右两侧的Margin
/*
int paddingLR = 2;
int paddingTB = 2;
*/
// TChip ZJ Minus END
int maxAllAppsWidth = (allAppsNumCols * (allAppsCellWidthPx + 2 * paddingLR));
int gridPaddingLR = (availableWidthPx - maxAllAppsWidth) / 4;
// Only adjust the side paddings on landscape phones,or tablets
if ((isTablet() || isLandscape) && gridPaddingLR > (allAppsCellWidthPx / 4)) {
padding.left = padding.right = gridPaddingLR;
}
// The icons are centered,so we can't just offset by the page indicator height
// because the empty space will actually be pageIndicatorHeight + paddingTB
padding.bottom = Math.max(0,pageIndicatorHeight - paddingTB);
pagedView.setAllAppsPadding(padding);
pagedView.setWidgetsPageIndicatorPadding(pageIndicatorHeight);
}
}
以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
小编个人微信号 jb51ccc
喜欢与人分享编程技术与工作经验,欢迎加入编程之家官方交流群!
更多推荐
所有评论(0)