Failed to create ToggleButton in Eclipse IDE for Android

In my graphic layout XML for Android it cannot display mine ToggleButton. I get some errors (see below). I checked all the other components in the palette window, and the only component that does not load is ToggleButton. The problem is not related to a specific project. It is saved in every project that I create.

Note. I tried to drag it directly, and also use the XML code to create it. But he fails anyway, and the error is the same.

Error:

Exception raised during rendering: -1
Exception details are logged in Window > Show View > Error Log
The graphics preview in the layout editor may not be accurate:
Different corner sizes are not supported in Path.addRoundRect. (Ignore for this session)
Path.isConvex is not supported. (Ignore for this session)

I mentioned this question and tried to edit it, but the change was rejected. Therefore, please do not redirect me there.

I use API 21. All build tools are installed.

+4
source share
4 answers

I had the same problem and decided to change the screen of the target device to any xhdpi or xxhdpi device.
Sorry, but I can’t post the images, all you have to do is go to the drop-down menu just above the graphic layout β†’ General or Google β†’ Choose the target device xhdpi / xxhdpi that you prefer.
I am also new to android, so I can’t explain why this is happening, I can only guess that it is a compatibility issue or something like that. I will try to find out more ..
In the meantime, I hope this also becomes useful to you :-)

+3

. . . .

0

, , , android:theme activity AndroidManifest.xml. Android Studio ( ) ( Light), Select Theme, Project Themes ( - ).

0
source

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 information Click [here] ( http://androidcoding.in/2016/09/11/android-tutorial-toggle-button/ "Android Toggle Button")

0
source

All Articles