如何使搜索栏占用母公司全宽 [英] How to make SeekBar take up full width of parent

查看:204
本文介绍了如何使搜索栏占用母公司全宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个搜索栏 RelativeLayout的,其宽度等于屏幕的宽度。

I have a SeekBar in a RelativeLayout whose width is equal to the screen width.

我申请 layout_width =match_parent搜索栏,但它似乎让双方都有点空的搜索栏,以容纳拇指。

I applied layout_width="match_parent" to the SeekBar but it seems to keep some empty space on both sides of the SeekBar to accommodate the thumb.

我也尝试过使用机器人:拇指=@空拇指走了​​,但不是在两侧的空

I also tried using android:thumb="@null" The thumb is gone but not the empty space on the sides.

我真的需要让搜索栏宽度匹配父。可能有人帮助我?也许我可以创建自定义的搜索栏类,并设置宽度为母公司宽度 onMeasure ()。如果这是一个可行的解决方案,我不知道我怎么能传递父宽度与搜索栏类。

I really need to make the SeekBar width match the parent's. Could somebody help me with this? Maybe I could create a custom SeekBar class and set the width to the parent width in onMeasure(). If this is a possible solution, I don't know how I could pass the parent width to the SeekBar class.

任何帮助是AP preciated。谢谢你。

Any help is appreciated. Thank you.

推荐答案

尝试定义与继搜索栏中的xml:

Try to define following with the SeekBar in xml:

android:padding="0dp"

这篇关于如何使搜索栏占用母公司全宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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