Belajardengan.com merupakan domain blog lama dari delajardengan.blogspot.com. Mohon kritik dan sarannya untuk perkembangan blog ini.
email: blog.tkx.pnp@gmail.com

coba Belajar Adroid (2)

♠ Posted by Unknown in at 7:42 PM
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Spannable;
import android.text.style.BackgroundColorSpan;
import android.text.style.StyleSpan;
import android.text.util.Linkify;
import android.widget.EditText;
import android.widget.TextView;

public class Tes2sanActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        EditText et =new EditText(this);
        et.setText("Ini merupakan salah satu contoh dari EditText");
        Spannable spn = et.getText();
        spn.setSpan(new BackgroundColorSpan(Color.RED), 0, 7,
        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        spn.setSpan(new StyleSpan(android.graphics.Typeface.BOLD_ITALIC)
        , 0, 7, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        setContentView(et);
    }
}

0 komentar:

Post a Comment