我正在处理 Seekbar
,我发现了一个问题。默认空间存在于左侧和右侧。我需要搜索栏是全宽的。我做了 match_parent
和 fill_parent
但这没有用。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<SeekBar
android:id="@+id/seek_bar_controller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dp" />
</RelativeLayout>
您可以按照此快照进行引用,左右手边都有空间。
请仔细阅读我的帖子并提出一些解决方案。
最佳答案
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<SeekBar
android:id="@+id/seek_bar_controller"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
/* In your activity */
SeekBar seekBar=(SeekBar)findViewById(R.id.seek_bar_controller);
seekBar.setPadding(0, 0, 0, 0);
关于android - 为什么我的搜索栏左右两侧有空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36057769/