在布局文件中发现意外的文字?

时间:2018-09-05 18:10:20

标签: android

这是我在这里的第一个帖子::)

我正在尝试编写一个应用程序。我绝对是写应用程序的新手。我在自己的content_main中粘贴了一个SneekBar。之后,我想在activity_main中为其编写代码。

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">


</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_main" />

int progress;

public void onProgressChanged (SeekBar seekBar, int progresValue, boolean fromUser){
SeekBar

}

</android.support.design.widget.CoordinatorLayout>

看到这个,我停下来写东西:

当我按F1时,它显示Google出现错误404。 我正在使用Android Studio 3.3 Canary 8。

我在做什么错了?

2 个答案:

答案 0 :(得分:0)

您在xml文件中编写Java代码。这会导致错误。 您要创建进度条?或者是其他东西? 这不是在android中编写代码的正确方法。

答案 1 :(得分:0)

此处使用XML文件设计布局。在Activity类中声明您的方法。您的情况是MainActivity.java,它位于app-> Java->(您的程序包名称)-> MainActivity.java中。我建议您看一些基本知识。

相关问题