Unable to create a ToggleButton in Eclipse IDE for android

后端 未结 4 584
轻奢々
轻奢々 2020-12-19 16:31

In my android XML Graphical Layout, it can not display my ToggleButton. I get some errors (see below). I have checked all other components in the Palette window

4条回答
  •  臣服心动
    2020-12-19 17:11

    I think you can use this code

     togglebut.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
    
                String text = togglebut.getText().toString();
    
                Toast.makeText(MainActivity.this, "" + text, Toast.LENGTH_SHORT).show();
    
                textView.setText(text);
    
            }
        });
    

    for more info Click [here](http://androidcoding.in/2016/09/11/android-tutorial-toggle-button/"Android Toggle Button")

提交回复
热议问题