How to leave a hidden seek bar until another button is clicked - Android

0

Hello. I have a silly doubt, but I will be very grateful to anyone who helps me! I am making an app in which in an activity I have an image view, several buttons and a seekbar. The idea is the following, I want to set an image in the image view in short with the button clicked and the value of the seek bar, for example ... Button 1+ seekBar 10 = image x Boot 2 + seek bar 8 = image and ...

For this I thought to leave the seekbar hidden or locked until the buttom is selected. and I would like the button to remain selected ... Can anyone help me with this code? how would it look ...

    
asked by anonymous 14.02.2018 / 02:02

1 answer

1

Welcome. I could not reproduce your question exactly, so this response assumes a normal SeekBar and a normal Button.

  

"I thought about letting the seekbar be hidden or locked until the buttom is selected."

You can set the visibility attribute in the layout and change it with setVisibility (int) when the button is clicked OR set the enabled attribute and change it with s etEnabled (boolean) .

<SeekBar
    android:id="@+id/seek_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone"
    <!-- android:enabled="false" --> />



Button button = findViewById(R.id.botao);
SeekBar seekBar = findViewById(R.id.seek_bar);
button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        seekBar.setVisibility(View.VISIBLE);
        //seekBar.setEnabled(true);
    }
});
    
16.02.2018 / 14:38