Back to project page RoboBinding-gallery.
The source code is released under:
Apache License
If you think the Android project RoboBinding-gallery listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.robobinding.gallery.model.customcomponent; // w w w. j a v a 2s . c o m import org.robobinding.gallery.R; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.LinearLayout; import android.widget.TextView; /** * * @since 1.0 * @version $Revision: 1.0 $ * @author Cheng Wei */ public class TitleDescriptionBar extends LinearLayout { private TextView title; private TextView description; public TitleDescriptionBar(Context context, AttributeSet attrs) { this(context, attrs, R.layout.title_description_bar); } protected TitleDescriptionBar(Context context, AttributeSet attrs, int layoutId) { super(context, attrs); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(layoutId, this); title = (TextView) findViewById(R.id.title); description = (TextView) findViewById(R.id.description); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitleDescriptionBar); String titleText = a.getString(R.styleable.TitleDescriptionBar_title); String descriptionText = a.getString(R.styleable.TitleDescriptionBar_description); a.recycle(); setTitle(titleText); setDescription(descriptionText); } public void setTitle(CharSequence titleText) { title.setText(titleText); } public void setDescription(CharSequence descriptionText) { description.setText(descriptionText); } }