如何删除和设置窗口小部件的边框颜色(FloatigSearchView)?特别是底部边框颜色

时间:2017-08-05 22:39:04

标签: java android xml floating

我将floatsearchview导入到我的应用中,我无法更改底部边框颜色并删除其他边框。在这一点上它看起来像这样 enter image description here

我正试图让它像下面的例子一样工作 enter image description here

链接到lib:https://github.com/arimorty/floatingsearchview

小部件的Xml代码:

<com.arlib.floatingsearchview.FloatingSearchView
        android:id="@+id/floating_search_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textAlignment="center"
        android:textColor="@color/color_white"
        android:textColorHint="@color/color_title_en"
        android:textCursorDrawable="@drawable/color_cursor"
        android:textSize="22sp"
        android:visibility="visible"
        app:floatingSearch_actionMenuOverflowColor="@color/color_primary_red"
        app:floatingSearch_clearBtnColor="@color/color_primary_red"
        app:floatingSearch_close_search_on_keyboard_dismiss="true"
        app:floatingSearch_dimBackground="false"
        app:floatingSearch_dismissOnOutsideTouch="true"
        app:floatingSearch_dividerColor="@color/color_primary_red"
        app:floatingSearch_leftActionColor="@color/color_primary_red"
        app:floatingSearch_leftActionMode="noLeftAction"
        app:floatingSearch_searchBarMarginLeft="@dimen/search_view_inset"
        app:floatingSearch_searchBarMarginRight="@dimen/search_view_inset"
        app:floatingSearch_searchBarMarginTop="@dimen/search_view_inset"
        app:floatingSearch_searchHint="@string/search_hint"
        app:floatingSearch_showSearchKey="true"
        app:floatingSearch_suggestionsListAnimDuration="150"
        app:floatingSearch_backgroundColor="@color/transparent"/>

1 个答案:

答案 0 :(得分:1)

存储库中的

This issue会询问相同的问题。似乎没有正式的方法,但是有一些hacky方法用来解决这个问题。

1)在XML代码中添加

app:floatingSearch_searchBarMarginLeft="-5dp"
app:floatingSearch_searchBarMarginRight="-5dp"
app:floatingSearch_searchBarMarginTop="-5dp"

2)在Java类中添加以下行。

mSearchView.findViewById(R.id.search_query_section).setBackgroundColor(Color.TRANSPARENT);