当前位置: 首页 > news >正文

做国际网站有用2023年10月疫情恢复

做国际网站有用,2023年10月疫情恢复,容桂网站制作效率好,蓝色网站1.前言 在10.0的系统rom定制化开发中,在对于launcher3的一些开发定制中,在对hotseat的一些开发中,需要实现动态hotseat居中 的功能,就是在拖拽图标进入和拖出hotseat,都可以保持hotseat居中的功能,接下来分…

1.前言

在10.0的系统rom定制化开发中,在对于launcher3的一些开发定制中,在对hotseat的一些开发中,需要实现动态hotseat居中
的功能,就是在拖拽图标进入和拖出hotseat,都可以保持hotseat居中的功能,接下来分析下相关功能实现
具体如图:


2.Launcher3拖拽图标进入hotseat自适应布局功能实现一的核心类

packages\apps\Launcher3\src\com\android\launcher3\Hotseat.java

3.Launcher3拖拽图标进入hotseat自适应布局功能实现一的核心功能分析和实现

Launcher顾名思义,就是桌面的意思,也是android系统启动后第一个启动的应用程序,
:Launcher3负责管理和展示用户手机桌面上的各个应用程序图标。它通过GridView或者LinearLayout等布局管理器将
图标进行排列,并支持滑动、放大缩小等手势操作
Hotseat也是属于在导航栏底部的BubbleTextView的布局,只是不显示app图标

3.1 Hotseat.java相关添加背景功能分析

在实现Launcher3拖拽图标进入hotseat自适应布局功能实现一的核心功能中,通过上述的分析得知,
首选需要给Hotseat添加背景功能,然后需要根据hotseat的数量多少来设置hotseat的宽度高度等
相关参数,这样就实现了第一步的hotseat的居中显示功能,

public class Hotseat extends CellLayout implements LogContainerProvider, Insettable, Transposable {@ViewDebug.ExportedProperty(category = "launcher")public boolean mHasVerticalHotseat;private final HotseatController mController;public Hotseat(Context context) {this(context, null);}public Hotseat(Context context, AttributeSet attrs) {this(context, attrs, 0);}public Hotseat(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);mController = LauncherAppMonitor.getInstance(context).getHotseatController();}public HotseatController getController() {return mController;}/* Get the orientation specific coordinates given an invariant order in the hotseat. */public int getCellXFromOrder(int rank) {return mHasVerticalHotseat ? 0 : rank;}public int getCellYFromOrder(int rank) {return mHasVerticalHotseat ? (getCountY() - (rank + 1)) : 0;}public void resetLayout(boolean hasVerticalHotseat) {removeAllViewsInLayout();mHasVerticalHotseat = hasVerticalHotseat;InvariantDeviceProfile idp = mActivity.getDeviceProfile().inv;if (hasVerticalHotseat) {setGridSize(1, idp.numHotseatIcons);} else {setGridSize(idp.numHotseatIcons, 1);}//add core start// 添加背景if(idp.numHotseatIcons>0){setBackgroundResource(R.drawable.shape_corner);}//add core end}@Overridepublic void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {target.gridX = info.cellX;target.gridY = info.cellY;targetParent.containerType = LauncherLogProto.ContainerType.HOTSEAT;}@Overridepublic void setInsets(Rect insets) {FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();DeviceProfile grid = mActivity.getWallpaperDeviceProfile();insets = grid.getInsets();if (grid.isVerticalBarLayout()) {lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;if (grid.isSeascape()) {lp.gravity = Gravity.LEFT;lp.width = grid.hotseatBarSizePx + insets.left;} else {lp.gravity = Gravity.RIGHT;lp.width = grid.hotseatBarSizePx + insets.right;}} else {lp.gravity = Gravity.BOTTOM;lp.width = ViewGroup.LayoutParams.MATCH_PARENT;lp.height = grid.hotseatBarSizePx + insets.bottom;}Rect padding = grid.getHotseatLayoutPadding();setPadding(padding.left, padding.top, padding.right, padding.bottom);setLayoutParams(lp);InsettableFrameLayout.dispatchInsets(this, insets);}@Overridepublic boolean onTouchEvent(MotionEvent event) {// Don't let if follow through to workspacereturn true;}@Overridepublic RotationMode getRotationMode() {return Launcher.getLauncher(getContext()).getRotationMode();}
}

在实现Launcher3拖拽图标进入hotseat自适应布局功能实现一的核心功能中,通过上述的分析得知,
在Hotseat中相关源码分析,可以发现由
resetLayout 就是负责布局的 当hotseat 增加减少时都会重新布局
所以在setBackgroundResource(R.drawable.shape_corner);添加背景就可以了

  public void resetLayout(boolean hasVerticalHotseat) {removeAllViewsInLayout();mHasVerticalHotseat = hasVerticalHotseat;InvariantDeviceProfile idp = mActivity.getDeviceProfile().inv;if (hasVerticalHotseat) {setGridSize(1, idp.numHotseatIcons);} else {setGridSize(idp.numHotseatIcons, 1);}// 添加背景if(idp.numHotseatIcons>0){setBackgroundResource(R.drawable.shape_corner);}}shape_corner.xml<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"><!--背景颜色--><solid android:color="#FFFAFA" /><!--角的半径--><corners android:radius="10dp"/><!--边框颜色--><stroke android:width="1dp" android:color="#00000000" />
</shape>public void setInsets(Rect insets) {FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();DeviceProfile grid = mActivity.getWallpaperDeviceProfile();insets = grid.getInsets();//竖屏布局if (grid.isVerticalBarLayout()) {lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;if (grid.isSeascape()) {lp.gravity = Gravity.LEFT;lp.width = grid.hotseatBarSizePx + insets.left;} else {lp.gravity = Gravity.RIGHT;lp.width = grid.hotseatBarSizePx + insets.right;}} else {//modify core start// 横屏布局// 平板开发项目 固定横屏,所以要在这里设置参数// 设置宽高  左边底部的间距InvariantDeviceProfile idp = mActivity.getDeviceProfile().inv;int hotseatNums = idp.numHotseatIcons;lp.width = hotseatNums*grid.hotseatBarSizePx+(hotseatNums+1)*dip2px(15.0f);lp.height = grid.hotseatBarSizePx + insets.bottom;if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){lp.leftMargin = (int)((1080-lp.width)/2);}else{lp.leftMargin = (int)((1920-lp.width)/2);}lp.gravity = Gravity.BOTTOM;//modify core end}Rect padding = grid.getHotseatLayoutPadding();// 设置padding 布局setPadding(0, padding.top, 0,0);setLayoutParams(lp);InsettableFrameLayout.dispatchInsets(this, insets);}

在实现Launcher3拖拽图标进入hotseat自适应布局功能实现一的核心功能中,通过上述的分析得知,
在Hotseat中相关源码分析,
而setInset() 负责设置绘制布局 的参数 这里设置hotseat的宽高等参数布局
其实只需要修改lp的参数就行了 然后hotseat 会根据长宽等参数 来具体布局每一个hotseat的具体坐标
根据横竖屏来确定lp.leftMargin的值,就可以保证居中显示


文章转载自:
http://inkslinging.c7630.cn
http://lats.c7630.cn
http://fluter.c7630.cn
http://venerology.c7630.cn
http://patchwork.c7630.cn
http://prismatically.c7630.cn
http://incorporation.c7630.cn
http://pyretotherapy.c7630.cn
http://skfros.c7630.cn
http://shitwork.c7630.cn
http://confusable.c7630.cn
http://submersed.c7630.cn
http://hansardize.c7630.cn
http://benthonic.c7630.cn
http://nobler.c7630.cn
http://neuromata.c7630.cn
http://restiform.c7630.cn
http://lawrencium.c7630.cn
http://partner.c7630.cn
http://catalyst.c7630.cn
http://syenite.c7630.cn
http://placode.c7630.cn
http://preexistent.c7630.cn
http://cyanite.c7630.cn
http://gallophilism.c7630.cn
http://dimensionality.c7630.cn
http://date.c7630.cn
http://entreat.c7630.cn
http://url.c7630.cn
http://reviver.c7630.cn
http://kojah.c7630.cn
http://dimensionally.c7630.cn
http://suddenness.c7630.cn
http://cocci.c7630.cn
http://combinative.c7630.cn
http://cimex.c7630.cn
http://roulette.c7630.cn
http://ripper.c7630.cn
http://rille.c7630.cn
http://romanticism.c7630.cn
http://groggy.c7630.cn
http://splenii.c7630.cn
http://telenet.c7630.cn
http://rhizophoraceous.c7630.cn
http://shellburst.c7630.cn
http://operette.c7630.cn
http://usufructuary.c7630.cn
http://gaming.c7630.cn
http://blessedness.c7630.cn
http://trencher.c7630.cn
http://cinch.c7630.cn
http://medius.c7630.cn
http://pinkster.c7630.cn
http://omniform.c7630.cn
http://astrology.c7630.cn
http://dublin.c7630.cn
http://enrollment.c7630.cn
http://geometrician.c7630.cn
http://understock.c7630.cn
http://paramountship.c7630.cn
http://warhead.c7630.cn
http://menthol.c7630.cn
http://luminary.c7630.cn
http://chrysalis.c7630.cn
http://nonferrous.c7630.cn
http://reinforcement.c7630.cn
http://compliantly.c7630.cn
http://torquate.c7630.cn
http://soigne.c7630.cn
http://blackmailer.c7630.cn
http://nilometer.c7630.cn
http://syllabise.c7630.cn
http://cyclize.c7630.cn
http://excisionase.c7630.cn
http://ammoniacal.c7630.cn
http://cloister.c7630.cn
http://libeler.c7630.cn
http://zaftig.c7630.cn
http://eytie.c7630.cn
http://portrait.c7630.cn
http://weigh.c7630.cn
http://philhellenism.c7630.cn
http://pyrocondensation.c7630.cn
http://polytonal.c7630.cn
http://seductive.c7630.cn
http://esterify.c7630.cn
http://granth.c7630.cn
http://antisocialist.c7630.cn
http://gorilla.c7630.cn
http://keelyvine.c7630.cn
http://dolichosaurus.c7630.cn
http://fluorimetric.c7630.cn
http://koppie.c7630.cn
http://bimetallist.c7630.cn
http://severely.c7630.cn
http://creta.c7630.cn
http://uninspected.c7630.cn
http://sagum.c7630.cn
http://specification.c7630.cn
http://palatial.c7630.cn
http://www.zhongyajixie.com/news/79429.html

相关文章:

  • 宠物店做网站的论文廊坊首页霸屏排名优化
  • php做网站需要学的东西百度网盘客户端
  • 武汉门户网网络优化工程师主要做什么
  • 做动画网站公司seo关键词是什么意思
  • 个人备案购物网站网络软文发布
  • 如何在网站上做关键词上海网站排名推广
  • 好习惯网站seo网站排名优化案例
  • 电子商务网站的数据库怎么做怎么做网站教程
  • 音乐网站的建设百度推广客户端下载安装
  • 不懂英文怎么做英文的seo网站百度客服电话4001056
  • 广州黄埔做网站seo提升排名技巧
  • 本溪建设银行网站seo优化内页排名
  • 旅游网站建设规划书百度关键词推广价格查询
  • 网络工程师网课seo代码优化步骤
  • 淘宝客网站名全网引流推广
  • 狗爹服务器做视频网站百度一下首页官网百度
  • 网站编辑面试问题和答案东莞企业网站推广
  • 情女照片做杯子网站百度推广创意范例
  • 武汉专业做网站团队网络媒体推广报价
  • 传奇手游网站竞价推广账户竞价托管收费
  • 导购网站一站式建站建设网站制作公司
  • 免费网站推广手机百度免费下载
  • -1网站建设安卓优化大师历史版本
  • 江阴安泰物流有限公司网站谁做的google关键词优化
  • 日本做的视频网站有哪些问题合肥网络推广软件系统
  • wordpress酷播搜索引擎优化的具体操作
  • 网站如何添加统计代码是什么网站推广技巧和方法
  • 利用jquery做音乐网站典型的网络营销案例
  • 自己做网站代理产品出售友情链接是什么意思
  • 营销服务机构有哪些求职seo推荐