If you think the Android project Go2-Rennes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*******************************************************************************
* Copyright (c) 2011 Michel DAVID mimah35-at-gmail.com
* /*fromwww.java2s.com*/
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/package fr.gotorennes.view;
import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import fr.gotorennes.R;
publicclass TitleBar extends RelativeLayout {
publicstaticfinalint ID = 0x1f080002;
private ImageView icon;
private TextView title;
private TextView subtitle;
public TitleBar(Context context) {
this(context, null);
}
public TitleBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TitleBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setId(ID);
setBackgroundResource(R.drawable.titlebar);
LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
vi.inflate(R.layout.title_bar, this);
icon = (ImageView) findViewById(R.id.icon);
title = (TextView) findViewById(R.id.title);
subtitle = (TextView) findViewById(R.id.subtitle);
}
publicvoid setIcon(int resId) {
this.icon.setImageResource(resId);
}
publicvoid setIcon(Bitmap icon) {
this.icon.setImageBitmap(icon);
}
publicvoid setTitle(int resId) {
this.title.setText(resId);
}
publicvoid setTitle(String title) {
this.title.setText(title);
}
publicvoid setSubtitle(int resId) {
this.subtitle.setText(resId);
this.subtitle.setVisibility(View.VISIBLE);
}
publicvoid setSubtitle(String subtitle) {
this.subtitle.setText(subtitle);
this.subtitle.setVisibility(View.VISIBLE);
}
}