安卓:搜索栏按钮中 [英] Android: seekbar in button

查看:191
本文介绍了安卓:搜索栏按钮中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Andr​​oid应用程序的按钮,我需要扩展它的点击和显示一个搜索栏里面,像下面的图片。什么是做到这一点的最佳做法?

I have a Button in my android application, and I need to expand it on click and display a Seekbar inside it, like at the picture below. What is the best practice to do that?

推荐答案

使用低于code处理按钮的点击设定搜索栏的公开程度不可见如果可见或可见,如果不可见的。

Use below code to handle tap of button to set visiblility of seekbar invisible if visible or visible if invisible.

 Button click = (Button) findViewById(R.id.but);
 Seekbar seek = (Seekbar) findViewById(R.id.seek); 


  click.setOnClickListener(new OnClickListener()
  {
    public void onClick(View v) {
       if (seek.getVisibility() == View.VISIBLE) { 
         seek.setVisibility(View.INVISIBLE); 
            } else { 
                seek.setVisibility(View.VISIBLE); 
            }
        }

  });

这篇关于安卓:搜索栏按钮中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆