Home>
            <SeekBar
            android: id = "@ + id/input_percent"
            android: layout_width = "match_parent"
            android: layout_height = "match_parent"
            android: max = "99" />


In Android Studio, when there is an xml with the above code and transition to the above xml,

protected void onCreate (Bundle savedInstanceState) {
        super.onCreate (savedInstanceState);
        setContentView (R.layout.activity_answer);
        // bar event
        if (1 == 1)
        {
            //https://techbooster.org/android/ui/8329/
            SeekBar seekBar = findViewById (R.id.input_percent);
        }
    }


And I am trying to set an event on @ + id/input_percent.
However, the characters in the input_percent part of "findViewById (R.id.input_percent)" become red, "Cannot resolve symbol 'input_percent'" is displayed, and the state that the seekBar is not assigned continues.
Please tell me how to solve this error.

  • Answer # 1

    I closed Android Studio about 75 minutes later and opened it (after hoshi-takanori sent back a reply). Then the above error was fixed.
    Thank you very much.