Android Seekbar cannot remove add-on / background

What I want to achieve is something like this, a search barrier without upper and lower indentation: enter image description here

What I get is: enter image description here

I even tried to set the background to transparent and then zero, but the background of the creeping line turns white, it doesnโ€™t look like the first image, I want the search arrow to look like it was placed between both layouts (the top layout is darker and the layout below is lighter as you see in both photos). I use basic attributes for search in xml, thanks!

EDIT: This is seekBar in XML. I do not believe that this has anything to do with the root layout, because everywhere, if I start a new project and I add a search bar, it still has this background, and if I try to set it to transparency, it will become white.

<SeekBar android:id="@+id/window_song_seekbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/primaryColor" android:paddingLeft="0px" android:paddingRight="0px" /> 
+6
source share
3 answers

Set the following attributes in xml. "Android: paddingStart =" 0dp "android: paddingEnd =" 0dp "

+1
source
Finally, I just thought. why not try changing it with java code. It is working! following code example:
 protected void initViews(Context context) { LayoutInflater.from(context).inflate(getLayoutResId(), this); ButterKnife.bind(this); // set style, just once seekBar.setProgress(0); seekBar.setMax(0); seekBar.setPadding(0, 0, 0, 0); // ... } 
-1
source

SOLVED, poor layout. I used LinearLayout as the root element with a vertical orientation, the search bar was in the middle of two relative layouts, I used android: background = "@ color / myColor" for the root layout, and then set the background to transparent and now I get the desired effect. And also I changed the root layout from linear layout to relative layout. Thanks!:)

-3
source

All Articles