Back to project page CenteredContentButton.
The source code is released under:
Apache License
If you think the Android project CenteredContentButton 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.skd.centeredcontentbuttontest; /*from w w w . ja v a 2 s . c o m*/ import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; import com.skd.centeredcontentbutton.CenteredContentButton; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final CenteredContentButton btn1 = (CenteredContentButton) findViewById(R.id.btn1); btn1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), btn1.getText(), Toast.LENGTH_SHORT).show(); } }); final CenteredContentButton btn2 = (CenteredContentButton) findViewById(R.id.btn2); btn2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), btn2.getText(), Toast.LENGTH_SHORT).show(); } }); final CenteredContentButton btn3 = (CenteredContentButton) findViewById(R.id.btn3); btn3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), btn3.getText(), Toast.LENGTH_SHORT).show(); } }); } }