Skip to content

Instantly share code, notes, and snippets.

@ar-android
Created June 13, 2015 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ar-android/f628346fe82a367531ec to your computer and use it in GitHub Desktop.
Save ar-android/f628346fe82a367531ec to your computer and use it in GitHub Desktop.
AdapterActionBar
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@SuppressLint("NewApi")
public class AdapterActionBar extends RelativeLayout {
TextView title, subtitle;
ImageView imgLogo;
public void setTitle(String title) {
this.title.setText(title);
}
public void setSubtitle(String subtitle) {
this.subtitle.setText(subtitle);
}
public AdapterActionBar(Context context) {
super(context);
init(context);
}
public AdapterActionBar(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public AdapterActionBar(Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(context);
}
private void init(Context context) {
LayoutInflater laybar = LayoutInflater.from(context);
laybar.inflate(R.layout.inflanter_actionbar, this);
imgLogo = (ImageView) findViewById(R.id.imgUser);
title = (TextView) findViewById(R.id.txTitle);
subtitle = (TextView) findViewById(R.id.txSubtitle);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment