@Override
public void setContentView(@LayoutRes int layoutResID) {
mBaseBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_base, null, false);
bindingView = DataBindingUtil.inflate(getLayoutInflater(), layoutResID, null, false);
// content
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
bindingView.getRoot().setLayoutParams(params);
RelativeLayout mContainer = (RelativeLayout) mBaseBinding.getRoot().findViewById(R.id.container);
mContainer.addView(bindingView.getRoot());
getWindow().setContentView(mBaseBinding.getRoot());
// 设置透明状态栏
StatusBarUtil.setColor(this, CommonUtils.getColor(R.color.colorTheme),0);
llProgressBar = getView(R.id.ll_progress_bar);
refresh = getView(R.id.ll_error_refresh);
ImageView img = getView(R.id.img_progress);
// 加载动画
mAnimationDrawable = (AnimationDrawable) img.getDrawable();
// 默认进入页面就开启动画
if (!mAnimationDrawable.isRunning()) {
mAnimationDrawable.start();
}
setToolBar();
// 点击加载失败布局
refresh.setOnClickListener(new PerfectClickListener() {
@Override
protected void onNoDoubleClick(View v) {
showLoading();
onRefresh();
}
});
bindingView.getRoot().setVisibility(View.GONE);
}
BaseActivity.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:GitHub
作者:
评论列表
文章目录