无法获得在搜索栏的拇指texBox的正确位置 [英] unable to get right position of texBox in Thumb of seekbar

查看:215
本文介绍了无法获得在搜索栏的拇指texBox的正确位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在android系统工作。我设计一个搜索栏。我加了大拇指那里。这是显示在正确的地方。

I am working in android. I am designing a seekbar. I added thumb there. It is showing at right place.

但在那个拇指我想显示文本框中的进展。对于这个我用这code:

But at that thumb I want to show progress in text box. For this I am using this code:

int xPos = ((seekbar.getRight() - seekbar.getLeft()) * seekbar.getProgress()) /
            seekbar.getMax();

但这个x坐标并不确切。这是一个有点不同。

But this x coordinate is not exact. It is a little bit different.

请给我建议,我应该为这个做的。

Please suggest me what should I do for this.

推荐答案

您已经计算沿搜索栏的距离,所以你只需要添加seekbar.getLeft()到它:

You've calculated the distance along the seekbar, so you just need to add seekbar.getLeft() onto it:

int xPos = (((seekbar.getRight() - seekbar.getLeft()) * seekbar.getProgress()) /
            seekbar.getMax()) + seekbar.getLeft();

这篇关于无法获得在搜索栏的拇指texBox的正确位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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