seekbar.setEnabled(false)使seekbar不可见

问题描述:

我遇到了seekbar问题。我想让它禁用,但是当我使用.setEnabled(false)函数时,我的seekbar消失。如何避免这种情况?seekbar.setEnabled(false)使seekbar不可见

我的布局:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/colorBackground"> 

    <SeekBar 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/seekBar" 
     /> 
</LinearLayout> 

我的代码:

SeekBar seekBar=(SeekBar) findViewById(R.id.seekBar); 
    seekBar.setEnabled(false); 
+0

我不确定'setEnable(false)'使seekbar消失。你应该发布你的布局/代码,所以其他开发人员可以帮助你。 – hakim

+0

我编辑我的帖子。这是我的代码。在这之后,我的seekbar是隐形的,但我只想让它禁用。 – MaSza

我还是dont't知道为什么我的搜索条消失,但我找到另一种方法来禁用此搜索条: https://stackoverflow.com/a/3278613/4313791