0
In meinem Fragment verwende ich searchView (nicht in der Symbolleiste). Mein Layout-Schnipsel:SearchView im Fragment (nicht in der Symbolleiste) kann die Unterstreichung nicht entfernen
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.SearchView
android:id="@+id/searchView"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:queryHint="Some hint"
android:layout_marginStart="20dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:searchHintIcon="@null" />
</android.support.constraint.ConstraintLayout>
In meinem Fragment Code:
searchView = view.findViewById(R.id.searchView);
SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
searchView.setSuggestionsAdapter(new SearchCatalogSuggestionsAdapter(getActivity()));
searchView.setBackgroundColor(Color.parseColor("#FFFFFF"));
Wie Sie ich versuche
searchView.setBackgroundColor(Color.parseColor("#FFFFFF"));
sehen kann aber unterstreichen, wird nicht helfen. Hier Screenshot:
Versuchen Sie, den Hintergrund als null für '' searchview ''festzulegen (funktioniert im Falle von' AutoCompleteTextView'). –
@LalitSinghFauzdar SearchView ist eigentlich ein LinearLayout und der Hintergrund wird auf einen EditText darin gesetzt, so dass es nicht funktioniert. –
Android: Hintergrund = "@ null" - nicht helfen – Alexei