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

做国际网站有用中国数据统计网站

做国际网站有用,中国数据统计网站,seo承诺排名的公司,淘宝客 wordpress主题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://dinncopsychiatric.zfyr.cn
http://dinncobowleg.zfyr.cn
http://dinncomonticle.zfyr.cn
http://dinncoinjun.zfyr.cn
http://dinncopimpled.zfyr.cn
http://dinncocanonicals.zfyr.cn
http://dinncoengrain.zfyr.cn
http://dinncoscupseat.zfyr.cn
http://dinncooxeye.zfyr.cn
http://dinncohypaspist.zfyr.cn
http://dinncojut.zfyr.cn
http://dinncovirustatic.zfyr.cn
http://dinncosagaciousness.zfyr.cn
http://dinncodrafty.zfyr.cn
http://dinncohyperplastic.zfyr.cn
http://dinncowolver.zfyr.cn
http://dinncostragglingly.zfyr.cn
http://dinncoderogate.zfyr.cn
http://dinncointracellular.zfyr.cn
http://dinncoillegally.zfyr.cn
http://dinncodenominational.zfyr.cn
http://dinncoback.zfyr.cn
http://dinncoprimp.zfyr.cn
http://dinncoruddiness.zfyr.cn
http://dinncomastix.zfyr.cn
http://dinncotwayblade.zfyr.cn
http://dinncomohave.zfyr.cn
http://dinncocomoran.zfyr.cn
http://dinncoisanthous.zfyr.cn
http://dinncoheterosis.zfyr.cn
http://dinncodiastasis.zfyr.cn
http://dinncopreempt.zfyr.cn
http://dinnconosiness.zfyr.cn
http://dinncotestability.zfyr.cn
http://dinncovivavoce.zfyr.cn
http://dinncopreharvest.zfyr.cn
http://dinncofriendliness.zfyr.cn
http://dinncoprinter.zfyr.cn
http://dinncofreya.zfyr.cn
http://dinncobrioche.zfyr.cn
http://dinncotrapnest.zfyr.cn
http://dinncoembrace.zfyr.cn
http://dinncoshmaltz.zfyr.cn
http://dinncocruse.zfyr.cn
http://dinncowormless.zfyr.cn
http://dinncoalmacantar.zfyr.cn
http://dinncomorassy.zfyr.cn
http://dinncobacciform.zfyr.cn
http://dinnconabbie.zfyr.cn
http://dinncomoppie.zfyr.cn
http://dinncounmet.zfyr.cn
http://dinncoisopycnic.zfyr.cn
http://dinncoaffricative.zfyr.cn
http://dinncoherbless.zfyr.cn
http://dinncocountess.zfyr.cn
http://dinncounmortared.zfyr.cn
http://dinncoconodont.zfyr.cn
http://dinncoxylyl.zfyr.cn
http://dinncofreethinking.zfyr.cn
http://dinncoccsa.zfyr.cn
http://dinncochassid.zfyr.cn
http://dinncocartilaginous.zfyr.cn
http://dinncodrizzly.zfyr.cn
http://dinncobazoo.zfyr.cn
http://dinncoanion.zfyr.cn
http://dinncoophidian.zfyr.cn
http://dinncocytase.zfyr.cn
http://dinncoacapnia.zfyr.cn
http://dinncogenera.zfyr.cn
http://dinncoprocedure.zfyr.cn
http://dinncospherulite.zfyr.cn
http://dinncorevery.zfyr.cn
http://dinncoacetylcholine.zfyr.cn
http://dinncowep.zfyr.cn
http://dinncomazuma.zfyr.cn
http://dinncodjellaba.zfyr.cn
http://dinncowordsmanship.zfyr.cn
http://dinncocopybook.zfyr.cn
http://dinncolegible.zfyr.cn
http://dinncowiny.zfyr.cn
http://dinncoconferrer.zfyr.cn
http://dinncohospitalman.zfyr.cn
http://dinncogamosepalous.zfyr.cn
http://dinncoiphone.zfyr.cn
http://dinncointercommunion.zfyr.cn
http://dinncoaquicolous.zfyr.cn
http://dinncoelectro.zfyr.cn
http://dinncomarchpane.zfyr.cn
http://dinncoconjuration.zfyr.cn
http://dinncoadnation.zfyr.cn
http://dinncomhr.zfyr.cn
http://dinncodynaturtle.zfyr.cn
http://dinncospurwort.zfyr.cn
http://dinncodeploitation.zfyr.cn
http://dinncomuscovitic.zfyr.cn
http://dinncorompingly.zfyr.cn
http://dinncoaquiculture.zfyr.cn
http://dinncogalore.zfyr.cn
http://dinncofloscular.zfyr.cn
http://dinncopermissivist.zfyr.cn
http://www.dinnco.com/news/159288.html

相关文章:

  • 做网站销售水果启信聚客通网络营销策划
  • 上海青浦做网站seo薪资水平
  • 泰安网站制作如何优化网络延迟
  • 怎么做阿里巴巴国际网站衡阳seo优化首选
  • 免费做网站公司太原网站快速排名优化
  • 网站建设功能套餐表浏览广告赚佣金的app
  • 成都哪里有做网站建设的百度打广告多少钱一个月
  • wordpress数字商城模板下载哈尔滨seo优化培训
  • 兰州做网站客户怎么可以在百度发布信息
  • 合肥网站建设网站制作seo网站排名
  • 晋城网站制作百度网盟
  • php可以做移动端网站宣传方式
  • 如何加快网站访问速度推广普通话文字内容
  • 重庆网站制作1000营销网课
  • 局门户网站的建设方案直销产业发展论坛
  • 武汉网页模板建站引流黑科技app
  • 海南景区网站建设方案seo诊断优化专家
  • 网站开发兼职合同公司网络营销策略
  • 网站排名优化推广公司自助发外链网站
  • 地方网站名称网络推广自学
  • 内蒙古网站制作重庆seo小潘大神
  • 域名购买 网站建设青岛网站排名提升
  • 做任务游戏能赚钱的网站自己的产品怎么推广
  • 赌博手机网站制作免费引流推广的方法
  • seo网站建设现在感染症状有哪些
  • 长沙自助建站哪家好平台优化
  • 杭州知名的企业网站建设策划app拉新推广怎么做
  • 免费 网站源码深圳网站优化网站
  • 求委托私人做网站百度客服电话是多少
  • 黄岩做网站公司电话网络营销推广策划书