Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

huangapple go评论60阅读模式
英文:

Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

问题

The seekbar after dragged it in the designer the bottom left show seekbar6 and also error that missing Constraints.

Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

and when switching to code I'm getting error on the SeekBar:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/seekBar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <SeekBar
        android:id="@+id/seekBar6"
        android:layout_width="377dp"
        android:layout_height="18dp"
        tools:layout_editor_absoluteX="21dp"
        tools:layout_editor_absoluteY="355dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

I tried in the designer to delete many times but it keeps adding a new seekbar with higher names like seekbar6, then seekbar7, and not just SeekBar and keeps giving these errors.

英文:

The seekbar after dragged it in the designer the bottom left show seekbar6 and also error that missing Constraints.

Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

and when switching to code I'm getting error on the SeekBar:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
    android:id=&quot;@+id/seekBar&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;
    tools:context=&quot;.MainActivity&quot;&gt;

    &lt;SeekBar
        android:id=&quot;@+id/seekBar6&quot;
        android:layout_width=&quot;377dp&quot;
        android:layout_height=&quot;18dp&quot;
        tools:layout_editor_absoluteX=&quot;21dp&quot;
        tools:layout_editor_absoluteY=&quot;355dp&quot; /&gt;
&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;

Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

I tried in the designer to delete many times but it keep adding new seekbar with higher name like seekbar6 then seekbar7 and not just SeekBar

and keep giving these errors.

答案1

得分: 1

我在xml中复制了你的代码,同样在开头遇到了一个约束错误消息。

所以,我手动添加了约束条件:

  • app:layout_constraintStart_toStartOf="parent"
  • app:layout_constraintTop_toTopOf="parent"

我还执行了一次Clean Project,然后进行了一次Rebuild Project

我附上了我创建的布局的代码和图片。

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<SeekBar
    android:id="@+id/seekBar6"
    android:layout_width="377dp"
    android:layout_height="18dp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

希望这对你的问题有所帮助 Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

英文:

I replicated your code in an xml, and in the same way at the beginning I got a constraint error message.

So, I added the Constraints manually

  • app:layout_constraintStart_toStartOf="parent"
  • app:layout_constraintTop_toTopOf="parent"

And also I did a Clean Project and then a Rebuild Project.

I attach the code and image of the layout that I made.

&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;match_parent&quot;
android:fitsSystemWindows=&quot;true&quot;&gt;

&lt;SeekBar
    android:id=&quot;@+id/seekBar6&quot;
    android:layout_width=&quot;377dp&quot;
    android:layout_height=&quot;18dp&quot;
    app:layout_constraintStart_toStartOf=&quot;parent&quot;
    app:layout_constraintTop_toTopOf=&quot;parent&quot;/&gt;

&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;

Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

Hope I helped with your problem Why when dragging each time a Widgets SeekBar it's giving it higher number name and also give error in android studio?

huangapple
  • 本文由 发表于 2023年5月22日 06:29:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76302180.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定