android - 为什么我的搜索栏左右两侧有空格?

标签 android xml android-layout android-studio seekbar

我正在处理 Seekbar,我发现了一个问题。默认空间存在于左侧和右侧。我需要搜索栏是全宽的。我做了 match_parentfill_parent 但这没有用。

enter image description here

<?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/

相关文章:

android - 操作栏不接受个人风格

xml - 如何使用 serde_xml_rs 根据标签名称将 XML 反序列化为不同的结构?

java - beans 或 xml 文件的问题

XML 数据绑定(bind)向导 float 和定点数

android - 平板电脑中的多桌面 (Android)

android - 使用 Room 递归调用 getDatabase

android - 无缝播放高质量的 youtube 视频是否有可能在 android 上?

javascript - WebView :webpage design changed in Android

java - 使用java在android中创建简单的线程?

android - 相对布局未低于定义