增加设置标题文本以及对齐方式API

This commit is contained in:
zengfantian 2015-10-29 17:11:04 +08:00
parent 5fe66c27a8
commit edeef588f4
1 changed files with 21 additions and 1 deletions

View File

@ -235,6 +235,26 @@ public abstract class BaseActivity extends FragmentActivity implements IBaseActi
mTitleBarContainer.setVisibility(View.GONE); mTitleBarContainer.setVisibility(View.GONE);
} }
/**
* 设置标题
* @param strTitle 标题文本
*/
public void setTitle(String strTitle){
setTitle(strTitle,Gravity.LEFT|Gravity.CENTER_VERTICAL);
}
/**
* 设置标题以及文本对齐方式
* @param strTitle 标题文本
* @param mTitleGravity 标题文本对齐方式
*/
public void setTitle(String strTitle,int mTitleGravity){
// 标题
TextView mTitleText = (TextView) findViewById(BaseView.gainResId(mApplication, BaseView.ID, "tv_title"));
mTitleText.setGravity(mTitleGravity);
mTitleText.setText(strTitle);
}
/** /**
* 设置标题栏背景颜色 * 设置标题栏背景颜色
* *