Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.abizareyhan;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.support.v7.widget.AppCompatButton;
import android.util.AttributeSet;
import com.abizareyhan.reyplayground.R;
public class CustomizableButton extends AppCompatButton {
public CustomizableButton(Context context) {
super(context);
inisialisasi();
}
public CustomizableButton(Context context, AttributeSet attrs) {
super(context, attrs);
inisialisasi();
}
public CustomizableButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
inisialisasi();
}
public void inisialisasi(){
GradientDrawable shape = new GradientDrawable();
shape.setShape(GradientDrawable.RECTANGLE);
shape.setCornerRadius(100);
shape.setColor(getResources().getColor(R.color.colorPrimary));
setBackground(shape);
setTextColor(getResources().getColor(R.color.colorWhite));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.