액션바를 커스터마이징 하려고 하는데 setCustomView에 제가 만든 뷰를 집어 넣었더니 작동은 되지만 TextView에 글자가 들어가지 않습니다. 고수님들 확인 부탁 드려요~~ㅠㅠ
1. 먼저 ActionBar에 커스터마이징 할 View를 집어 넣어 줍니다.(CustomActionBar 클래스)
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayShowCustomEnabled(true);
getActionBar().setCustomView(new CustomActionBar(this));
((CustomActionBar)getActionBar().getCustomView()).SetActionBarTitle(R.string.MainMenu);
2. CustomActionBar의 모습입니다.
public class CustomActionBar extends View {
Context mContext = null;
TextView action_bar_title = null;
View view = null;
public CustomActionBar(Context context) {
// TODO Auto-generated constructor stub
super(context);
mContext = context;
view = inflate(mContext, R.layout.action_bar_title_layout, null);
action_bar_title = (TextView) view.findViewById(R.id.action_bar_title);
}
public void SetActionBarTitle(int resId) {
action_bar_title.setText(resId);
}
}
결과적으로 텍스트가 들어가 있어야 할 자리에 텍스트가 없어요...ㅠㅠ