本文主要是介绍Android13 Hotseat客制化--Hotseat修改布局、支持滑动、去掉开机弹动效果、禁止创建文件夹,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
需求如题,实现效果如下 :
固定Hotseat的padding位置、固定高度
step1 在FeatureFlags.java中添加flag,以兼容原生态代码
public static final boolean STATIC_HOTSEAT_PADDING = true;//hotseat area fixed
step2:在dimens.xml中添加padding值和高度值
<dimen name="hotseat_padding_left">0px</dimen><dimen name="hotseat_padding_top">0px</dimen><dimen name="hotseat_padding_right">0px</dimen><dimen name="hotseat_padding_bottom">0px</dimen><dimen name="hotseat_height">218px</dimen>
step3:Hotseat.java的public void setInsets(Rect insets)接口中,改为高度不通过计算,直接读取dimension
private final int mHotseatHeight;public Hotseat(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);addView(mQsb);mQsbHeight = getResources().getDimensionPixelSize(R.dimen.qsb_widget_height);mHotseatHeight = getResources().getDimensionPixelSize(R.dimen.hotseat_height);//added by Kevin}public void setInsets(Rect insets){.....} else {mQsb.setVisibility(View.VISIBLE);lp.gravity = Gravity.BOTTOM;lp.width = ViewGroup.LayoutParams.MATCH_PARENT;//lp.width = ViewGroup.LayoutParams.WRAP_CO
这篇关于Android13 Hotseat客制化--Hotseat修改布局、支持滑动、去掉开机弹动效果、禁止创建文件夹的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!