gpt4 book ai didi

android - 无法在 android studio Gradle : invalid symbol: 'switch' 中编译项目

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:33:00 25 4
gpt4 key购买 nike

我正在使用 Android studio 来编译项目。项目最小 SDK 为 14,目标为 17。

我正在使用这个代码。

<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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">


<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Switch"
android:id="@+id/switch" android:layout_alignBottom="@+id/button3" android:layout_toRightOf="@+id/button3"
android:layout_marginLeft="44dp"/>


</RelativeLayout>

enter image description here

最佳答案

如果您将交换机的 ID 更改为“@+id/switch”以外的其他内容,则可以解决此错误。例如:

 <Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Switch"
android:id="@+id/Switch"
android:layout_below="@+id/Switch"
android:layout_alignLeft="@+id/Switch"/>

将是一个有效的开关。

来源:https://code.google.com/p/android/issues/detail?id=55720

关于android - 无法在 android studio Gradle : invalid symbol: 'switch' 中编译项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16728178/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com