Back to project page BounceMe.
The source code is released under:
MIT License
If you think the Android project BounceMe 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.cse3345.f13.martin; // w ww. j av a 2 s . c o m import android.app.Activity; import android.graphics.Paint; import android.graphics.Typeface; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; public class CreditActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.credits); Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/shades.ttf"); ViewGroup parent = ((ViewGroup)getWindow().getDecorView()); setTypeFace(tf, parent); //back button finishes the activity and goes back to the previous one Button back = (Button) findViewById(R.id.back); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } public static void setTypeFace(Typeface custom, ViewGroup parent){ for(int i = 0; i < parent.getChildCount(); i++){ View v = parent.getChildAt(i); if(v instanceof ViewGroup){ setTypeFace(custom, (ViewGroup) v); }else if(v instanceof TextView){ TextView tv = (TextView) v; tv.setTypeface(custom); tv.setPaintFlags(tv.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); }else if(v instanceof Button){ Button b = (Button) v; b.setTypeface(custom); b.setPaintFlags(b.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); } } } }