Android中的CheckBox自定义勾选框无法显示使用


package com.example.hello;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class Deom_d3_CheckBox extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener, View.OnClickListener {


    private CheckBox cb_one;
    private CheckBox cb_two;
    private CheckBox cb_three;
    private Button btn_send;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.deom_d3);
        cb_one = (CheckBox) findViewById(R.id.cb_one);
        cb_two = (CheckBox) findViewById(R.id.cb_two);
        cb_three = (CheckBox) findViewById(R.id.cb_three);
        btn_send = (Button) findViewById(R.id.btn_send);
        cb_one.setOnCheckedChangeListener(this);
        cb_two.setOnCheckedChangeListener(this);
        cb_three.setOnCheckedChangeListener(this);
        btn_send.setOnClickListener(this);
    }
    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b)
    {
        if(compoundButton.isChecked())
            Toast.makeText(this,compoundButton.getText().toString(),Toast.LENGTH_SHORT)
                    .show();
    }
    @Override
    public void onClick(View view) {
        String choose = "";
        if(cb_one.isChecked())choose += cb_one.getText().toString() + "";
        if(cb_two.isChecked())choose += cb_two.getText().toString() + "";
        if(cb_three.isChecked())choose += cb_three.getText().toString() +
                "";
        Toast.makeText(this,choose,Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onPointerCaptureChanged(boolean hasCapture) {

    }
}

img

我这边他不显示效果图也不知道出了什么问题我看别人就是这么打的但我就在自定义勾选框效果上出现问题
程序可以正常运行就是勾选框没了

img


解决了原来是因为我将check_enable与checkable弄混了导致了自定义勾选框错误无法显示

你把xml发出来吧

android:button="@null" 
android:drawableStart="@drawable/check_button"

把selector的checkable的两行去掉试试