Widget - Image Button

Anmol dwivedi
0
final ImageButton imageButton = new ImageButton(MainActivity.this);
imageButton.setImageResource(R.drawable.icon);
imageButton.setLayoutParams(new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.WRAP_CONTENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT));
linear1.addView(imageButton);

imageButton.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

showMessage("Clicked!");
}

});

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)
Our website uses cookies to enhance your experience. Learn More
Accept !