android hotseat 布局,android Launcher : hotseat 解析

一、hotseat基本信息

Launcher2/res/xml-sw600dp/default_workspace.xml

launcher:packageName="com.android.dialer"

launcher:className="com.android.dialer.DialtactsActivity" //这里注意不要写成"com.android.dialer/.DialtactsActivity"

launcher:container="-101"

launcher:screen="1" //第1屏,0-4共5屏

launcher:x="1"      //图标X位置

launcher:y="0" />   //图标Y位置

launcher:container="-101" 表示"hotseat"

二、Hotseat尺寸

1、/Launcher2/res/values/config.xml

true

5

2

100

/Launcher2/src/com/android/launcher2/CellLayout.java

mHotseatScale = (res.getInteger(R.integer.hotseat_item_scale_percentage) / 100f);

2、hotseat cell大小

Launcher2/res/values/dimens.xml

64dp

64dp

如果此二值不够大,会导致hotseat上的icon显示不完整。

3、AllApp尺寸

void resetLayout() {

mContent.removeAllViewsInLayout();

// Add the Apps button

Context context = getContext();

LayoutInflater inflater = LayoutInflater.from(context);

BubbleTextView allAppsButton = (BubbleTextView)

inflater.inflate(R.layout.application, mContent, false);

allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null,

context.getResources().getDrawable(R.drawable.all_apps_button_icon), null, null);

allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));

allAppsButton.setOnTouchListener(new View.OnTouchListener() {

@Override

public boolean onTouch(View v, MotionEvent event) {

if (mLauncher != null &&

(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {

mLauncher.onTouchDownAllAppsButton(v);

}

return false;

}

});

allAppsButton.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(android.view.View v) {

if (mLauncher != null) {

mLauncher.onClickAllAppsButton(v);

}

}

});

// Note: We do this to ensure that the hotseat is always laid out in the orientation of

// the hotseat in order regardless of which orientation they were added

int x = getCellXFromOrder(mAllAppsButtonRank);

int y = getCellYFromOrder(mAllAppsButtonRank);

CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1);

lp.canReorder = false;

mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true);//Await

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值