@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_message_list); this._mainFrame = (RelativeLayout) this.findViewById(R.id.mainFrame); MainMenuData mainMenuData = ConfigDAL.getNormalMainMenuData(); if (mainMenuData != null) { this._mainFrame.setBackgroundColor(mainMenuData.getBackgroundColor()); } this._titleBar = (TitleBar) this.findViewById(R.id.titleBar); this._titleBar.showLogo(false); this._titleBar.showOkButton(false); this._titleBar.setTextTitle(true, "消息"); this._titleBar.setOnTitleBarListener( new OnTitleBarListener() { @Override public void OnBackClick(View v) { finish(); } @Override public void OnPopupMenuClick(View v) {} @Override public void OnOk(View v, String clickUrl) {} }); this._listView = (ListView) this.findViewById(R.id.listView); this.dataFill(); }
public TitleBar(Context context, AttributeSet attrs) { super(context, attrs); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.title_bar, this); this._uiHanlder = new Handler(context.getMainLooper()) { @Override public void handleMessage(Message msg) { super.handleMessage(msg); Bundle bundle = msg.getData(); String imageFileName = bundle.getString("imageFileName"); Bitmap bitmap = BitmapFactory.decodeFile(imageFileName); _btnOkImage.setImageBitmap(bitmap); } }; this._titlaMainFrame = (RelativeLayout) this.findViewById(R.id.titlaMainFrame); this._mainMenuData = ConfigDAL.getNormalMainMenuData(); this._titlaMainFrame.setBackgroundColor(this._mainMenuData.getBackgroundColor()); this._labTitle = (TextView) this.findViewById(R.id.labTitle); this._btnBack = (Button) this.findViewById(R.id.btnBack); this._btnOK = (Button) this.findViewById(R.id.btnOK); this._btnMenu = (Button) this.findViewById(R.id.btnMenu); this._btnOkImage = (ImageView) this.findViewById(R.id.btnOkImage); this._imgLogo = (ImageView) this.findViewById(R.id.imgLogo); this._imgTitlePic = (ImageView) this.findViewById(R.id.imgTitlePic); // this._btnMenu = (ImageButton) this.findViewById(R.id.btnMenu); this._txtNumText = (TextView) this.findViewById(R.id.txtNumText); this._btnBack.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { if (TitleBar.this._onTitleBarListener != null) { TitleBar.this._onTitleBarListener.OnBackClick(v); } } }); this._btnMenu.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { if (TitleBar.this._onTitleBarListener != null) { TitleBar.this._onTitleBarListener.OnPopupMenuClick(v); } } }); OnClickListener btnOkLintener = new OnClickListener() { @Override public void onClick(View v) { if (TitleBar.this._onTitleBarListener != null) { TitleBar.this._onTitleBarListener.OnOk(v, _clickUrl); } } }; this._btnOK.setOnClickListener(btnOkLintener); this._btnOkImage.setOnClickListener(btnOkLintener); }