Back to project page psiandroid.
The source code is released under:
GNU General Public License
If you think the Android project psiandroid 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 com.phpsysinfo.ui; //from ww w . j a va 2s. c om import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.widget.LinearLayout; import android.widget.TableRow.LayoutParams; import android.widget.TextView; import com.phpsysinfo.R; public class HeaderTextView extends TextView { public HeaderTextView(Context context) { super(context); custom(); } public HeaderTextView(Context context, AttributeSet attrs) { super(context, attrs); custom(); } public HeaderTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); custom(); } protected void onDraw (Canvas canvas) { super.onDraw(canvas); } public void custom() { this.setBackgroundColor(getResources().getColor(R.color.header)); this.setTypeface(null,Typeface.BOLD); this.setPadding(5, 5, 5, 5); LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); llp.setMargins(0, 5, 0, 5); this.setLayoutParams(llp); Resources res = getResources(); int resourceId = res.getIdentifier("up", "drawable", getContext().getPackageName()); Drawable img = res.getDrawable(resourceId); this.setCompoundDrawablesWithIntrinsicBounds(img, null , null, null); } }