RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mCenterClock.getLayoutParams();
if(isStatusIconVisibile()){
params.setMarginStart(0);
params.leftMargin=2;
mCenterClock.setLayoutParams(params);
}else{
params.setMarginStart(34);
params.leftMargin=2;
mCenterClock.setLayoutParams(params);
}
//逻辑某一个的判断
private boolean isStatusIconVisibile(){
boolean flag=true;
for (int i = 0; i < mStatusIcons.getChildCount(); i++) {
StatusBarIconView v = (StatusBarIconView) mStatusIcons.getChildAt(i);
flag= flag&&(v.getVisibility()== View.GONE);
Log.d(TAG,"flag is: "+flag +" v.getVisibility()"+v.getVisibility());
}
return !flag;
}
代码控制view显示位置
最新推荐文章于 2021-05-25 20:04:11 发布