【问题标题】:seekbar.setEnabled(false) make seekbar invisibleseekbar.setEnabled(false) 使搜索栏不可见
【发布时间】:2016-10-03 16:55:35
【问题描述】:

我的搜索栏有问题。我想让它禁用,但是当我使用 .setEnabled(false) 函数时,我的搜索栏消失了。如何避免这种情况?

我的布局:

<?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);

【问题讨论】:

  • 我不确定setEnable(false) 是否让搜索栏消失。您应该发布您的布局/代码,以便其他开发人员可以帮助您。
  • 我编辑我的帖子。这是我的代码。在此之后我的搜索栏是不可见的,但我只想让它禁用。

标签: java android seekbar mobile-development


【解决方案1】:

我仍然不知道为什么我的搜索栏消失了,但我在这里找到了另一种禁用搜索栏的方法: https://stackoverflow.com/a/3278613/4313791

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-29
    • 1970-01-01
    相关资源
    最近更新 更多