Android 如何暂时禁用Seekbar?

Android How to disable Seekbar temporarily?

有没有办法暂时禁用Seekbar? 我尝试了 setEnabled(false) 和 setClickable(false)。它不工作。帮我。 提前致谢。

XML 代码:

<com.devadvance.circularseekbar.CircularSeekBar
        android:id="@+id/circularSeekBar1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        app:lock_enabled="true"
        app:pointer_halo_color_ontouch="#ffd180"
        app:start_angle="150"
        app:end_angle="30"
        app:circle_x_radius="150"
        app:circle_y_radius="140"
        app:use_custom_radii="true"
        app:max="10"
        app:pointer_alpha_ontouch="100"
        app:pointer_color="#ffd180"
        app:circle_stroke_width="3"
        app:pointer_halo_color="#ffd180"
        android:layout_marginLeft="18dp"
        android:layout_marginTop="12dp"
        android:layout_marginRight="18dp"
        android:layout_marginBottom="-25dp"
        android:layout_below="@+id/textView"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

在 JAVA 代码中:

CircularSeekBar seekbar = (CircularSeekBar) findViewById(R.id.circularSeekBar1);
    seekbar.setAlpha(0.45f);
    seekbar.setEnabled(false);
Try this:-

In your xml:
 <SeekBar
        android:id="@+id/seekBar_bedrm"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"/>

In your code:-
 SeekBar seekBar_bedrm;
 seekBar_bedrm = (SeekBar) findViewById(R.id.seekBar_bedrm);
 seekBar_bedrm.setEnabled(true);

我找到了暂时禁用搜索栏的答案。

在 Xml 中,只需创建一个 visibility:GONE

的布局
<LinearLayout
                        android:id="@+id/Mainlayout"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent">
     <LinearLayout
                        android:id="@+id/seekbarblocklayout"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:orientation="vertical"
                        android:clickable="true"
                        android:visibility="gone"
                        />
    <com.devadvance.circularseekbar.CircularSeekBar
            android:id="@+id/circularSeekBar1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
    ....
    ....
    />

</LinearLayout>

在Java,

    public void disableSeekbar{

             seekbarblocklayout=(LinearLayout)findViewById(R.id.seekbarblocklayout);
            seekbarblocklayout.setVisibility(LinearLayout.VISIBLE);
            seekbarblocklayout.bringToFront();
    }

  public void enableSeekbar{
            seekbarblocklayout.setVisibility(LinearLayout.GONE);
    }