Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

xml - Unable to create a ToggleButton in Eclipse IDE for android

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 and the only component that fails to load is ToggleButton. The problem is not project specific. It persists in every project I create.

Note: I have tried dragging it directly as well as using XML code to generate it. But it fails either way and the error is 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 have referred this question and tried to edit it but the edit was rejected. So please do not redirect me there.

I am using API 21. All the build tools are installed.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same problem and solved by changing my target device screen to any of the xhdpi OR xxhdpi devices.
I'm sorry but I'm not able to post images yet, all you have to do is go to the dropdown menu just above the graphical layout -> General OR Google -> Select the xhdpi/xxhdpi target device you prefer.
I'm also new to android so I'm not able to explain why this is happening, I can only guess it's a compatibility issue or something. I'll try finding out more..
In the meantime I hope this will turn useful for you as well :-)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...