如何在具有可绘制背景的searchview上删除下划线

问题描述 投票:0回答:1

Snapshot from emulator

如何删除如图所示的下划线?将其设置为透明或更改背景无济于事。

已经尝试过以下解决方案:How to remove white underline in a SearchView widget in Toolbar Android

将样式都更改为actionbar-searchview,并以编程方式进行。更改querybackground的问题是它将忽略我已经设置的可绘制背景。

    <SearchView
    android:id="@+id/searchViewBar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/rounded_corner"
    android:focusable="true"
    android:queryHint=" "
    />
android android-layout searchview underline
1个回答
0
投票

尝试以下代码:

View v = searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
v.setBackgroundColor(Color.parseColor("here give actionbar color code"));
© www.soinside.com 2019 - 2024. All rights reserved.