arimorty / floatingsearchview

A search view that implements a floating search bar also known as persistent search
https://github.com/arimorty/floatingsearchview/blob/master/README.md
Apache License 2.0
3.54k stars 668 forks source link

Don't overlay cancel over long search text, and set search text margin option. #120

Closed CillianMyles closed 8 years ago

CillianMyles commented 8 years ago

Hi @arimorty,

I have 2 possible enhancements for the library.

I am using the search bar not in full-screen, as part of the width of the screen: https://mrkr.io/43zNGZOcsM

(1) If the search text becomes too long, it sits behind the clear button. See here: https://mrkr.io/cGYhEEvPcr I think you could be fixed by adding the following:

android:layout_toStartOf="@+id/clear_btn"
android:layout_toLeftOf="@+id/clear_btn"

to the FrameLayout here: https://github.com/arimorty/floatingsearchview/blob/master/library/src/main/res/layout/search_query_section.xml#L43

(2) I would love to be able to set the margin of the search text view so that it's centered in the view better. Basically setting these: https://github.com/arimorty/floatingsearchview/blob/master/library/src/main/res/layout/search_query_section.xml#L48-L49

Let me know what you think of the enhancements. If you wish, I will make a PR for these 2 and the other enhancement I recently reported.

arimorty commented 8 years ago

The first enhancement was actually a bug that was fixed in the latest release (2.0.3) check your version and let me know if the problem is still there.

For the second enhancement, I understand that you need the text to be centered, but the purpose of this library is implement a material design search as specified in the Material Design specs. I might add an option for that in a future release, but for now you can still get a reference to the TextView programmatically and set the property that you want.

CillianMyles commented 8 years ago

I have checked 2.0.3 and this is fixed for me. And your solution to my second point works as well. Thanks!