Skip to content

Instantly share code, notes, and snippets.

@pavelupward
pavelupward / CheckableImageButton.java
Created March 19, 2018 14:46 — forked from AlexKorovyansky/CheckableImageButton.java
Implementation of checkable ImageButton, with behaviour similar to Checkbox and support of state_checked selectors. Based on http://kmansoft.com/2011/01/11/checkable-image-button/
public class CheckableImageButton extends ImageButton implements Checkable {
private boolean checked;
private boolean broadcasting;
private OnCheckedChangeListener onCheckedChangeListener;
private static final int[] CHECKED_STATE_SET = { android.R.attr.state_checked };
public CheckableImageButton(Context context) {
<!-- http://stackoverflow.com/questions/1700099/android-how-to-create-a-background-from-pattern -->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/subtlepatterns_escheresque_ste"
android:tileMode="repeat" />
private PopupWindow mPWMenu;
private LinearLayout mLMenu;
private float sD;
private Context appContext;
private void showPopupWindow() {
mLMenu = (LinearLayout) appContext.LayoutInflater().inflate(R.layout.layer_menu, null);
mLMenu.setFocusableInTouchMode(true);
mPWMenu = new PopupWindow(mLMenu, (int) (260*sD), WindowManager.LayoutParams.WRAP_CONTENT, true);
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild