android XML view Does not display ToggleButton in

2019-02-26 19:58发布

In my android XML Graphical Layout, I am unable to display my ToggleButton. I receive some errors (see below). Also, I am not able to edit anything else using the Graphical Layout.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.thunder4apps.lanterna.corinthians.MainActivity" >



    <ToggleButton 
    android:id="@+id/togglebutton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textOn="Vibrate on"
    android:textOff="Vibrate off"
    android:onClick="onToggleClicked"/>


</RelativeLayout>

Error :

Exception raised during rendering: -1
Exception details are logged in Window > Show View > Error LogThe 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)

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-02-26 20:20

I think You haven't got the right android packages installed. Make sure your API is set to the correct one (As in not android wear). Just click on you SDK manager and install the correct api. including all the extras. cheers !

查看更多
\"骚年 ilove
3楼-- · 2019-02-26 20:24

Go to your graphical layout and locate the drop down of the API levels, probably you are using the last one 21, and you don´t have it installed, change to other lever according to your app.

enter image description here

查看更多
登录 后发表回答